SELECT * FROM msg_messages m
JOIN msg_status s on m.messageId = s.messageId
JOIN msg_threads t ON t.threadId = m.threadId
JOIN users u ON u.userId = s.userId
WHERE t.threadId = 1
GROUP BY u.userId ORDER BY `m`.`date` DESC
this is the query which give me always first index of every record. but i want get latest index in each group.. i tried many ways but result is nothing.
user: