各位高手,我现在有2个表A和B,结构差不多,但是A表中有几个数据在B表中没有。而我现在想知道B表中没有的数据,该怎么操作,希望各位指点,谢谢

解决方案 »

  1.   

    select  * from a where not exists(select 1 from b where a.col1=b.co11 and a.col2=b.col2.......)
      

  2.   

    select * from a
    except
    select * from b
      

  3.   

    select * from a where not exists(select 1 from b where id=a.id)
      

  4.   

    select * from a where not exists(select * from b where id=a.id)