MySql order by problem
- by Sergio
Hello.
I want to list messages that received specific user from other users group by ID's and ordered by last message received.
If I use this query:
SELECT MAX(id), fromid, toid, message FROM pro_messages WHERE toid=00003 GROUP BY
fromid
I do not get last message sent from user "fromid" to user "toid" but the first message sent. Can I do that in some other way or I need to do it with two queries or join tables?
id - message id
fromid - id of user who sent message
toid - id of user who receive message (in this case user 00003)