I am using the following query to get the latest 2 messages of the same conversation:
SELECT *
FROM messages
WHERE conversation_id
IN ( 122806, 122807 )
GROUP BY conversation_id
ORDER BY sent_on DESC
LIMIT 2
Which return message7
and message3
as result.
What I need is to get latest 2 messages grouped by conversation_id, therefore the result should be:
message3
message1
message4
message5