1.分开写
select * from a where f1 not in(select f1 from b) and f2 not in(select f2 from b)
2.
select a.* from a a left join b b on a.f1=b.f1 and a.f2=b.f2 where b.f1 is null and b.f2 is null
select * from a where f1 not in(select f1 from b) and f2 not in(select f2 from b)
2.
select a.* from a a left join b b on a.f1=b.f1 and a.f2=b.f2 where b.f1 is null and b.f2 is null
學習
我刚才使用了一个很笨的方法
select a.*
from a where cast(a.f1 as varchar(20))+cast(a.f2 as varchar(20))
not in (select cast(b.f1 as varchar(20))+cast(b.f2 as varchar(20)) from b)
学习,散分!