求A表和B表的差集
有A表和B表,表结构相同,
如:A表
A B C
1 1 河北
1 2 天津
。。。。。
B表
A B C
1 1 河北
1 2 天津
。。。。。
想求出B表比A表多出来的记录
[解决办法]
select * from B where not exists(select 1 from A where A.A=B.A and A.B=B.B and A.C=B.C)
[解决办法]
select b.* from b where not exists(select 1 from a where a.a = b.a and a.b = b.b and a.c = b.c)
[解决办法]
select b.* from b where not exists(select 1 from a where a.a = b.a and a.b = b.b and a.c = b.c)