not exists 比not in的速度快,如要数据量很庞大,应建立索引

解决方案 »

  1.   

    select a.c from a,b where a.c<>b.c
      

  2.   

    select a.* from a, b
    where a.c<>b.c试试看,好象不行
      

  3.   

    对于oracle,还可以用minus(集合减运算)
      

  4.   

    用minus速度比not in快很多,
    再问一下,对于oracle,还有那些集合运算的命令
      

  5.   

    我没测试,你试一下吧
    select * from (select a.*,b.c c1 from a,b where a.c=b.c(+)) d where d.c1 is null;
      

  6.   

    select * from (select a.*,b.c c1 from a,b where a.c=b.c(+)) d where d.c1 is null;
    好用的,谢谢
    在问一下,对于oracle,除了union,monus还有那些集合运算的命令
      

  7.   

    我这样写得:
    select c from a minus select c from b集合运算有:
    union,union all,intersect,minus