执行顺序依次向下:
insert into temptable(p0)select c5 from temp_user a having count(c5) > 1 group by c5;select count(a.c5) from temp_user a where a.c5 not in (select it.p0 from temptable it where it.p0 is not null);select count(distinct a.c5) from temp_user a where a.c5 not in (select it.p0 from temptable it where it.p0 is not null);为什么后面的两条查询语句返回结果不一样?
求高手帮助!

解决方案 »

  1.   

    查看temp_user表中的c5字段是不是有null存在?
      

  2.   

    insert into temptable(p0)select c5 from temp_user a having count(c5) > 1 group by c5;
    这个没报错?
      

  3.   

    就是多了个distinct 所以不一样 去掉重复的
      

  4.   

    迷惑……
    如果你temp_user的c5列本来就不为空的,那么你后面两个SQL语句查询出来的结果应该是一样的才对!出现这种结果不一样的问题,一定是C5列有空值!  如果不为空,结果肯定一样!有可能你在执行了第一句SQL后,别的session向temp_user的c5列插入了空值。你再看看。