Let's say I have a table called messages
with the columns:
id | from_id | to_id | subject | message | timestamp
I want to get the latest message from each user only, like you would see in your FaceBook inbox before you drill down into the actual thread.
This query seems to get me close to the result I need:
SELECT * FROM messages GROUP BY from_id
However the query is giving me the oldest message from each user and not the newest.
I can't figure this one out.