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