where 是 mysql 语句的查询条件
表 a1
xy110220330表 a2
xy101002020020300 create table if not exists `a1`( `x` int(10), `y` int(10) ); create table if not exists `a2`( `y` int(10), `z` int(10) )左连情况下, 由于左边a1.y = 30在右表无数据所以右表数据 (y,z)为 NULL
由于是左连, 所以判断 (a1.y = a2.y && a2.y = 10) 只能筛选出(10, 100)与左边匹配, 所以后面均为 NULL. 即实际优先级是 select * from (a1 left join a2 on a1.y = a2.y and a2.y = 10)
只有一条数据, 因此可判断其优先级为select * from (a1 left join a2 on a1.y = a2.y) where a2.y = 10. 也就是说 会先左连生成临时表, 然后再在整体表上进行 where 查询.