--以下两条语句查询结果一样
select * from t_gasbrand t1 left join t_userfiles t2 on t1.id = t2.f_gasbrand_id where t1.id = 17 --注意这里必须是where不能是and!!!where是取交集而and在left join 语句中并没有效果
select * from t_gasbrand t1,t_userfiles t2 where t1
sql语句之坑 连接查询的两种方式:left join 和 另一个
最新推荐文章于 2022-05-18 00:18:18 发布
本文探讨了在SQL查询中使用LEFT JOIN时遇到的问题,特别是当尝试在连接条件外使用AND添加额外条件时,这些条件可能无法如预期工作。通过案例分析,解释了为何这种情况会发生以及如何正确构造查询语句。
摘要由CSDN通过智能技术生成