MySQL order by before group by

后端 未结 9 2468
梦谈多话
梦谈多话 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条回答
  •  醉话见心
    2020-11-22 07:26

    Just use the max function and group function

        select max(taskhistory.id) as id from taskhistory
                group by taskhistory.taskid
                order by taskhistory.datum desc
    

提交回复
热议问题