select count(*) from where c01d27 IN ('2', '8')select count(*) from where c01d27='2' or c01d27='8'
SQL> select count(*) from c01d where c01d27='2' or c01d27='8';
Executed in 0.531 seconds
Executed in 0.515 seconds
Executed in 0.515 seconds
SQL> select count(*) from c01d where c01d27 IN ('2', '8');
Executed in 0.547 seconds
Executed in 0.516 seconds
Executed in 0.547 seconds能看出来好一点...select count(*) from where  c01d26 NOT IN ('2025', '2027', '2029') ;下周接着测下班了。....

解决方案 »

  1.   

    这2个的区别不是很明白,学习来了,只知道如果数据量很大的话,可以采用NOT EXIST
      

  2.   

    not in时候和not exists时有些差异
    not in (NULL) 为true
    not exists(NULL) 为false
      

  3.   

    子查询中的数据多的时候使用exists/ not exists,子查询中数据少的时候用in/ not in,我的理解应该是这样子吧。
      

  4.   

    楼主问的只有两个数据,in 与 or的速度可能差别不是很大。如果in中的数据多的话可能要考虑使用exists而不是in或or了。
      

  5.   

    用union试试
    select count(*) from where c01d27='2'
    unoin all
    select count(*) from where c01d27='8'