select 的 IN 与NOT IN 的问题如:1、select count(*) from table where name not in ('li','b','c','d')
    2、select count(*) from table where name in ('li','b','c','d')这两句的结果的和不是应该=select count(*) from table 吗?还是有什么没有考虑到的?

解决方案 »

  1.   

    如我在一张表格上查找
    in 的是0
    not in 1290
    而总数为9000多
    是什么问题呢?
      

  2.   

    还有NULL的情况,剩下的应该都是NULL了..
      

  3.   

    如果还有一个name为'ab',那这个应该怎么处理?
    是在in里,还是not in 里?
      

  4.   

    我的建议是select name from table where name not in ('li','b','c','d')
    然后      select name from table where name in ('li','b','c','d')
    在然后是select name from table。这样我想就知道是什么原因了。