Manu Prasadh
Manu Prasadh

Reputation: 1

How to sort the sender's names in inbox?

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.

Upvotes: 0

Views: 36

Answers (1)

aashah7
aashah7

Reputation: 2195

You must sort by the sender.

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

Upvotes: 0

Related Questions