例如:
 select sum(d), a, b, c from talbe where a=1 group by a, b, c order by b, c这个sql是先根据where查询,然后分组后在排序。 是这样的顺序吗??查询, 分组, 排序 都是按什么顺序执行的啊。

解决方案 »

  1.   

    是这样的顺序,order by是最后一个执行的
      

  2.   

    1,from talbe 
    2,where a=1 
    3,group by a, b, c
    4,select sum(d), a, b, c  
    5,order by b, c
      

  3.   

    1、from table
    2、on
    3、left|right|inner join
    4、where
    5、group by
    6、with cube|rollup
    7、having
    8、select
    9、distinct
    10、order by asc|desc
    11、into table