SQL语句中 left join 后用 on 还是 where,区别大了!
点击上方 java项目开发 ,选择 星标 公众号
重磅资讯,干货,第一时间送达 ---
来自: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’
PS:如果觉得我的分享不错,欢迎大家随手点赞、在看。
推荐阅读:
怎么接私货?这个渠道你100%有用!请收藏!喜欢文章,点个在看
评论