0

I want to sort an inbox by the sender's name.

I have the following MySQL query I am using to sort:

SELECT * 
FROM (
  SELECT * 
  FROM Msg_Tab 
  ORDER BY uid DESC
) AS searchmsg 
GROUP BY sender;

But, here it's not sorting if I send any message. It's only sorting while I'm receiving messages.

MySQL table : Msg_Tab

Columns: sender, receiver, time, message.

aashah7
  • 2,075
  • 1
  • 17
  • 24

1 Answers1

0

You must sort by the sender.

SELECT * 
FROM (
  SELECT * 
  FROM Msg_Tab 
  ORDER BY uid DESC
) AS searchmsg 
GROUP BY sender
ORDER BY sender;
aashah7
  • 2,075
  • 1
  • 17
  • 24