left join 后加and條件與where條件有什么區別


僅作為自己的學習筆記


left join 后加where 約束整個查詢結果;

left join 后加and,and條件不能限制左表,僅能限制右表。

例如 from a left join b on a.id=b.id and a.id<5; 此and后條件無效;

例如 form a left join b on a.id=b.id and b.id<5;    可以限制查詢結果中b的id小於5;

例如 from a left join b on a.id=b.id where a.id<5; 此where條件可以成功約束查詢結果中a的id小於5;

 


免責聲明!

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



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