select * from b where not exists(select * from a where a.gx=b.gx and a.date=b.date)

解决方案 »

  1.   

    select * from b where not exists(select * from a where gx=b.gx and date=b.date)
      

  2.   

    select * from b where not exists(select * from a where a.gx=b.gx and a.date=b.date)
      

  3.   

    select b.*
    from B left join A on a.gx=b.gx and a.date=b.date
    where a.gx is null
      

  4.   

    你的例子:select * from b as b1 
    where not exists (
    select 1 from a 
    where a.gx=b.gx
    and a.[date]=b.[date]       
    )
      

  5.   

    select * from b where not exists(select * from a where a.gx=b.gx and a.date=b.date)
      

  6.   

    select * from 表B where not exists (select 1 from 表A where 表A.gx=表B.gx and 表A.date=表B.date)
      

  7.   

    victorycyz(中海) 的是正确的。
      

  8.   

    select * from B where not exists (select * from A where A.gx=B.gx and A.date=B.date)
      

  9.   

    樓主按照你的要求語法應該按下面的寫:
    select * from b where gx not in (select gx from a ) and date not in ( select date from a)
      

  10.   

    left outer join 效率高些,同意victorycyz(中海)的!