select * from t1 where not exists(select * from t2 where id=t1.id)

解决方案 »

  1.   

    select * from 表1 where name not in (select name from 表2)
      

  2.   

    select * from 表1 where name not in (select name from 表2)
      

  3.   


    http://community.csdn.net/Expert/topic/4074/4074053.xml?temp=3.107852E-02
      

  4.   

    select * from t1 where not exists(select * from t2 where id=t1.id)服务器: 消息 156,级别 15,状态 1,行 1
    在关键字 'not' 附近有语法错误。--------------------------------------------------------
    select * from 表1 where name not in (select name from 表2)
    这个思维我早试过了,不行的。
      

  5.   

    select t1.* from t1 left join t2 on t1.id=t2.id where t2.id is null
      

  6.   

    ok,done。
    正确答案是:
    select * from t1 left join t2 on t1.id=t2.id where t2.id is null
      

  7.   

    select a.* from t1 a where not exists(select 1 from t2 where id=a.id and name=a.name)