select * from table1
where not exists(select * from table2 where table1.userID=table2.userID)

解决方案 »

  1.   

    select * from table1 where userID!=table2.userID
      

  2.   

    select * from table1 where userid not in (select userid userid from table2 );
    不过表如果数据量比较大的话速度会慢点。
      

  3.   

    not in 不行啊,我试了
      

  4.   

    select table1.* from table1,table2 where table1.userID<>table2.userID
    你试下可以不
      

  5.   

    SELECT * FROM TABLE1
    WHERE NOT EXISTS (SELECT 1 FROM TABLE2 WHERE TABLE1.USER_ID=TABLE2.USER_ID)
      

  6.   

    Select * From table1 Where table1.userid Not In (Select userid From table2 Where table1.userid=table2.userid),谁说不可以用NOT IN ,我都通过啦
      

  7.   

    如果数据量大的话可以加上PARALLEL(表名,数值)
    例如:
    Select /*+parallel(A,10) Parallel(B,10)*/  * From table1 A  Where A.userid Not In (Select userid From table2 B Where A.userid=B.userid),