I'm trying to get my head around with the group by command, basically I'm trying to select all messages of a user, group them by subject then show them - just like how face book does it.
The result should have the latest message id, the sender's id, the date, and the total count of the messages in that subject.
The message table can look like the following:
message ------- id sender_id subject created_at
So the result should show all user's messages grouped by the same subject.