left join 的On 与查询条件 where 的疑难杂症
1、
select a.col1 ,count(*) as qty
from a
left join b on b.col2 = a.col2 and b.role = 3 and b.void = 'n'
left join c on a.col1 = c.col1
where c.void= 'n'
group by a.col
2、
select a.col1 ,count(*) as qty
from a
left join c on a.Col2 = c.Col2 , b
where c.void= 'n' and a.Col1 = b.Col1 and b.role = 3 and b.void = 'n'
group by a.col1
对于2 语句能完全符合要求,为什么1不能呢,是left join 的On 的问题。why?高手指教!