Here is my code:
mysql_query("SELECT * FROM messages WHERE to_user_id = '$user_id' GROUP BY from_user_id ORDER BY read,sent_date DESC")
and here is my table structure

I use the GROUPY BY from_user_id statement to briefly show a list of “conversations” instead of every single message. Like this

But, as you can see in the image, the top two are the wrong way round, the first one says “1 week ago” and the one below says “2 days ago”. The reason for these being in the wrong order is due to the GROUP BY from_user_id statement. Because it groups all the messages from that user and it wont have the the most recent time on it.
So my question is:
How can I GROUP BY from_user_id by the most recent record?
Try with this