I am attempting to get a list of messages, by grouping the from_user_id
and to_user_id
so they look like the screenshot below. Only, my problem is they do not seem to be ordering by the most recent.
Here's a screenshot showing how they look:
Query: select
select
concat(to_user_id, from_user_id) as group_by,
pm.*
from personal_messages pm
where (to_user_id = 1265) or (from_user_id = 1265)
group by group_by
order by id desc
Table Structure: