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