这里有三条sql语句,想找到存在tblA中,却又不在tblB中的记录数

select count*from tblA
select count(*from tblA where pid in ( select pid from
 tblB)
select count(*from tblA where pid not in  select pid from tblB)今天发现了一个sql的小问题
结果运行的结果是
今天发现了一个sql的小问题1070
按理应该是 10,7,3 才对阿,
后来才发现最后一句应该这样写
今天发现了一个sql的小问题select count(*from tblA where pid not in (select pid from tblB where pid is not null)

运行后的结果才对:10,7,3
只是不知道为什么最后一句不取掉空项就select 不出来

相关文章: