SQL Server 替換 not in 的用法


select * from T_A a (nolock) where a.xh not in (select xh from T_B)

方法1:效果甚微

select * from T_A a (nolock) where not exists (select xh from T_B where xh=a.xh)

方法2:效果比想象的要好。

select * from T_A a (nolock) left join T_B b on b.xh=a.xh where b.xh is null


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM