I want to create a message system where users can send messages to each other. It should be thread-based like in Facebook. So every user should be in only one specific message-thread with another single user.
The main overview of all messages isn't working as I want it to be. It only shows the oldest (first) message text and date of a thread and doesn't sort by latest message sent.
This is my SELECT-Statement and I think I need a sub-query somewhere to let it sort by the latest date and text, but I'm not familiar with that and also don't know where to put that and how? 
So basically I just want that the message threads are sorted by the latest message received, showing the latest text and date of a specific thread.
    $menu = mysql_query("SELECT 
t.`id`, t.`creator_uid`,
c.`uid` AS content_uid, c.`text`, c.`date` AS content_date,
a.`status`, a.`date` AS assign_date,
CASE 
WHEN t.`creator_uid`='".sInput($_SESSION['uid'])."' THEN `receiver_uid`
WHEN t.`receiver_uid`='".sInput($_SESSION['uid'])."' THEN `creator_uid`
END AS uid
FROM `messages_content` c
LEFT JOIN `messages_thread` t ON t.`id` = c.`thread_id`
LEFT JOIN `messages_assign` a ON a.`id` = t.`id`
WHERE 
t.`creator_uid`='".sInput($_SESSION['uid'])."' 
OR 
t.`receiver_uid`='".sInput($_SESSION['uid'])."' 
GROUP BY t.`id` 
ORDER BY c.`id` DESC") or die (mysql_error());
MySQL database structure:
messages_assign: id,uid,thread_id,status,date
messages_content: id,uid,thread_id,text,date
messages_thread: id,creator_uid,receiver_uid
