вроде как-то так, если правильно понимаю
SELECT m.*, u.* FROM messages m
INNER JOIN users u ON m.receiver = u.id
INNER JOIN (
SELECT receiver, sender, max(date) as date
FROM messages
GROUP BY receiver, sender
) m2 ON m.receiver = m2.receiver
AND m.sender = m2.sender
AND m.date = m2.date
WHERE u.id = 1
ORDER BY m.date DESC
но не понятно зачем джойнится users на ресейвера, может все-таки на сендера? ведь в диалоге должны отображаться имена отправителей??
SELECT m.*, u.* FROM messages m
INNER JOIN users u ON m.sender = u.id
INNER JOIN (
SELECT receiver, sender, max(date) as date
FROM messages
GROUP BY receiver, sender
) m2 ON m.receiver = m2.receiver
AND m.sender = m2.sender
AND m.date = m2.date
WHERE m.receiver = 1
ORDER BY m.date DESC