http://zhangzhaoaaa.iteye.com/blog/1689412参考:《MYSQL技术内幕SQL编程》
select distinct <selectlist>
from lefttable
<join-type>join <righttable>
on <join_condition>
where<where_condition>
group by<groupbylist>
with{CUBE|ROLLUP}
HAVING<havingcondition>
order by<orderbylist>
limit<limitnumber>
处理顺序
- from
- on
- join
- where
- group by
- cube|rollup
- having
- select
- distinct
- order by
- limit