Mysql query - problem with order by
- by Sergio
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?