日期:2014-05-17 浏览次数:20635 次
with A as (
select 1 as id,'张三' as name ,150 as pay union all
select 2 as id,'李四' as name ,150 as pay union all
select 3 as id,'王五' as name ,150 as pay union all
select 4 as id,'赵六' as name ,150 as pay union all
select 5 as id,'刘七' as name ,150 as pay
),B as
(select 1 as id,'张三' as name ,150 as pay union all
select 2 as id,'李四' as name ,160 as pay union all
select 3 as id,'王五' as name ,150 as pay union all
select 4 as id,'赵六' as name ,150 as pay
)
select A.*,B.*
from A left join B on A.id = B.id
where not exists (select 1 from B where A.id = B.id and A.name=B.name and A.pay=B.pay)
select a.*,b.* from 发放金额 a,发放金额备份 b where a.id=b.id and (a.姓名<>b.姓名 or a.工资<>b.工资 or a.奖金<>b.奖金 or a.津贴<>b.津贴)