infos表
sql1select person.name,infos.age from person LEFT JOIN infos on person.id = infos.person_id and infos.age=11
image.png
sql2select person.name,infos.age from person LEFT JOIN infos on person.id = infos.person_id where infos.age=11
image.png
left join on and
这种写法会返回左表的所有数据
left join on where
会对数据进行筛选
网友评论