faizanrockstar
New Member
Suppose, I want to show a list of users ordering by the most number of messages they have sent.I have 2 tables: \[code\]Users\[/code\] and \[code\]Messages\[/code\]I have 10 usersUser A sent 20 messages (have 20 rows in Messages table)\[code\]SELECT * FROM messages WHERE user='A'User B sent 17 msgs User C sent 19 User D sent 13\[/code\]and so on.I want to a query that will list Users in order of their total messages sent. Like:\[code\]1. A (20 msgs)2. C (19 msgs)3. B (17 msgs)4. D (13 msgs)\[/code\]I tried hard but I can't find any query to execute this. Please help. Thanks in advance.