select c from a where c not in(select c from b)

解决方案 »

  1.   

    select c from a where not exist(select c from b where a.c=b.c)
      

  2.   

    select c from a where not exists(select c from b where a.c=b.c)
      

  3.   

    对,就是这个
    select c from a where not exists(select c from b where a.c=b.c)
      

  4.   

    select c from a where not exists(select c from b where a.c=b.c)
      

  5.   

    select * from A
    left join B
    on A.C=B.C
    where B.C is null
      

  6.   

    select c from b where c no in (select c from a)
    这样写感觉容易理解啊!
      

  7.   

    select c from a where not exists(select c from b where a.c=b.c)
      

  8.   

    select c from A where c not in (select c from B)
      

  9.   

    SELECT a.c
    FROM a LEFT OUTER JOIN
          b ON a.c = b.c
    WHERE (b.c IS NULL)
      

  10.   

    select c from a where c not in (select c from b)
      

  11.   

    a表,b表
    -------
    c    c
    1    2
    2    1
    3    3
    4    1当然是:select c from a where c not in (select c from b)结果是:4
    而下面
    select c from a where not exists(select c from b where a.c=b.c)结果是:1,2,4 当然是不正确的
      

  12.   

    select c from a where not exists(select c from b where a.c=b.c)
      

  13.   

    select c from a where not exists(select c from b where a.c=b.c)
    也是正确
      

  14.   

    select c from a where c not in (select c from b)

    SELECT a.c
    FROM a LEFT OUTER JOIN
          b ON a.c = b.c
    WHERE (b.c IS NULL)
    两者都对,前者用嵌套,后者用左外连接。但是如果数据量比较大,后者的效率要高的多
      

  15.   

    同意楼上的说法!
    用left outer join
      

  16.   

    SELECT DISTINCT C FROM A JOIN B ON A.C=B.C AND C NOT IN (SELECT DISTINCT C FROM B)