--以下两条语句查询结果一样
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.id = t2.f_gasbrand_id and t1.id = 17
--如果这样写就错误了
select * from t_gasbrand t1 left join t_userfiles t2 on t1.id = t2.f_gasbrand_id and t1.id = 17 --用and连接并不能起到筛选的效果,and在left join 中是无效的,虽然语法上没有报错
在left join 语句中 使用and添加条件无效: