SQL语句中 left join 后用 on 还是 where,区别大了!
点击关注上方“Stephen”,
设为“置顶或星标”,第一时间送达干货
来自:blog.csdn.net/wqc19920906/article/details/79785424
select * from student s left join class c on s.classId=c.id order by s.id
select * from student s left join class c on s.classId=c.id and s.name="张三" order by s.id
select * from student s left join class c on s.classId=c.id and c.name="三年级三班" order by s.id
select * form tab1 left join tab2 on (tab1.size = tab2.size) where tab2.name=’AAA’
select * form tab1 left join tab2 on (tab1.size = tab2.size and tab2.name=’AAA’)
tab1.size = tab2.size
tab2.name=’AAA’
tab1.size = tab2.size and tab2.name=’AAA’
END
喜欢就三连
点击"阅读原文"可跳转至我的博客。
关注 Stephen,一起学习,一起成长。
评论