sql 中order by 和group by 能在同一个sql语句中连着用吗?

解决方案 »

  1.   

    可以的,可以写个sql语句试验一下
      

  2.   

      在sql命令格式使用的先后顺序上,group by 先于 order by。
     
      select 命令的标准格式如下:
     
       SELECT select_list
       [ INTO new_table ]
       FROM table_source
       [ WHERE search_condition ]
       [ GROUP BY group_by_expression ]
       [ HAVING search_condition ]
       [ ORDER BY order_expression [ ASC | DESC ] ]