Tuesday 27 September 2022

How to Get Data in Descending order using group by in mysql

How to Get Data in Descending order using group by in mysql


SELECT player_messages.*

FROM     player_messages
WHERE    (receiver_user_id, sender_user_id, insertdate) IN (
           SELECT   receiver_user_id, sender_user_id, MAX(insertdate)
           FROM     player_messages
           WHERE    receiver_user_id='33'
           GROUP BY receiver_user_id, sender_user_id)
ORDER BY player_messages.insertdate DESC

 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.