select * from B表 where not exists(select 1 from A表 where nodekey=B表.nodekey and name=B表.name)

解决方案 »

  1.   

    select B.* from TableA A,TableB B Where A.nodekey<>B.nodekey
      

  2.   

    select * from B表 where not exists(select 1 from A表 where nodekey=B表.nodekey and name=B表.name)
      

  3.   

    select * from B表 where not exists(select 1 from A表 where nodekey=B表.nodekey and name=B表.name)
      

  4.   

    select * from B表 where not exists(select 1 from A表 where nodekey=B表.nodekey and name=B表.name)
      

  5.   

    select * from B表 where not exists(select 1 from A表 where nodekey=B表.nodekey and name=B表.name)
    OR:select b.* from B表 b left join A表 a on a.nodekey=b.nodekey and a.name=b.name
    where a.nodekey is null
      

  6.   

    用not in 或exists就可以了
      

  7.   

    有两个表他们结构一样,如A(nodekey,name,bz)和B(nodekey,name,bz)
    A表中nodekey和name为主键,B表中也是nodekey和name为主键。
    写出SQL语句,检索出在B表中存在而在A表中不存在的记录集。select * from B where not exists(select 1 from A where nodekey=b.nodekey and name=b.name)