SELECT id, thread_id, user_id, subject, body, date_sent
FROM messages WHERE date_sent IN (
SELECT MAX( date_sent )
FROM messages WHERE user_id =6 GROUP BY thread_id
)
ORDER BY thread_id ASC , date_sent DESC;
Låt mig veta om det fungerar nu