Reputation: 1
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
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