Is there a [straightforward] way to order results *first*, *then* group by another column, with SQL?

前端 未结 5 915
遥遥无期
遥遥无期 2021-01-12 19:07

I see that in SQL, the GROUP BY has to precede ORDER BY expression. Does this imply that ordering is done after grouping discards identical rows/columns?

Because I s

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-12 19:46

    Select a,b from (select a,b from table order by b) as c group by a;
    

提交回复
热议问题