I'm using two tables for selecting messages between users. Table "messages" for recording the messages and table "members" for checking users data (are they activ or deleted).
This query working fine.
What I need to do is list the received messsages order by last received. I tried to do with "ORDER BY messages.id DESC" at the end of this query but it didn't work. All messages are listed from first received.
This is the mysql join table query that I'm using:
sql = "SELECT DISTINCT messages.fromid,
messages.readed,
messages.fromid,
messages.toid ,
members.id AS pid
FROM messages
INNER JOIN members
ON members.id = messages.fromid
WHERE messages.toid = ".$mid."
AND members.status = 7
AND messages.kreaded !='1'
AND messages.subject != 'readed'
GROUP BY fromid"
Is there any way to do this?