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

解决方案 »

  1.   

    select * from A where exists (select 1 from from B where a.f1=b.f1 and a.f2=b.f2)
      

  2.   

    select * from A where not exists (select 1 from from B where a.f1=b.f1 and a.f2=b.f2)
      

  3.   

    select * from A where not exists (select 1 from from B where a.f1=b.f1 and a.f2=b.f2)
      

  4.   

    select * from A where not exists (select 1  from B where a.f1=b.f1 and a.f2=b.f2)这个是正确的
      

  5.   

    select * from a where not exists (select * from b where b.f1=a.f1 and b.f2= a.f2)
    學習
      

  6.   

    非常感谢 Frewin(Frewin)和long0104() ,极度精辟
    我刚才使用了一个很笨的方法
    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)
    学习,散分!