I'm having a lot of trouble applying other people's answers to this question, so I decided to just post it here to see if any of you could help me. I am trying to get a unique list of people messaged from a database where the fields are:
id, sender, recipient, timestamp, message
The problem is I would like to display the unique list with the most recent messaged user first, but MySQL seems to in the process of making it unique choose the rows added earliest. Can you help me reverse that? This is the query I am currently using.
SELECT DISTINCT recipient, sender FROM chat WHERE recipient = '$username' OR sender = '$username' ORDER BY timestamp DESC limit 50
Thank you so much!