MySQL order by before group by

后端 未结 9 2400
梦谈多话
梦谈多话 2020-11-22 06:57

There are plenty of similar questions to be found on here but I don\'t think that any answer the question adequately.

I\'ll continue from the current most popular qu

9条回答
  •  Happy的楠姐
    2020-11-22 07:42

    No. It makes no sense to order the records before grouping, since grouping is going to mutate the result set. The subquery way is the preferred way. If this is going too slow you would have to change your table design, for example by storing the id of of the last post for each author in a seperate table, or introduce a boolean column indicating for each author which of his post is the last one.

提交回复
热议问题