Oracle in 查询数据


问题描述:

  查询所有的数据,查询结果:146360

select count(1) from bank_cde; 

  in查询的获取部分数据,查询结果 :73080

select count(1) from bank_cde t where t.belongcode2  in('ABC','BCOM','BOC','CCB','CEB','CGB','CIB','CITIC','CMBC','ICBC','PAB','POST','SPDB');

  not in查询数据,结果为0

select count(1) from bank_cde t where t.belongcode2 not in('ABC','BCOM','BOC','CCB','CEB','CGB','CIB','CITIC','CMBC','ICBC','PAB','POST','SPDB');

原因:

  本以为in 和not in 为查询两种结果互补,还有一种情况 为 null

select count(1) from bank_cde t where t.belongcode2 is null;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM