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