日期:2014-05-18 浏览次数:20533 次
--dm,ztz,sj,xj
select * from b
except
select * from a
--如果b包含a,可以
select *
from b t
where not exists (select 1 from a where dm=t.dm and ztz=t.ztz and sj=t.sj and xj=t.xj)
--如果b和a不是互相包含的
select *
from b t
where not exists (select 1 from a where dm=t.dm and ztz=t.ztz and sj=t.sj and xj=t.xj)
union
select *
from a t
where not exists (select 1 from b where dm=t.dm and ztz=t.ztz and sj=t.sj and xj=t.xj)