title: MySQL ORDER BY multiple column ASC and DESC
body: <p>I have 2 MYSQL tables, <strong>users</strong> and <strong>scores</strong>. Detail:</p>
  
  <ul>
  <li>users table:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/NwNDy.png" alt="enter image description here"></p>
  
  <ul>
  <li>scores table:</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/3q8Gc.png" alt="enter image description here"></p>
  
  <p>My intention is get 20 users list that have <strong>point</strong> field sort DESC (descending) combine <strong>avg_time</strong> field sort ASC (ascending). I use the query:</p>
  
  <pre><code>SELECT users.username, scores.point, scores.avg_time
  FROM scores, users
  WHERE scores.user_id = users.id
  GROUP BY users.username
  ORDER BY scores.point DESC, scores.avg_time
  LIMIT 0, 20
  </code></pre>
  
  <p>The result is:</p>
  
  <p><img src="https://i.stack.imgur.com/kYqY8.png" alt="enter image description here"></p>
  
  <p>The result is wrong because the first line is exactly point = 100 and avg_time = 60.</p>
  
  <p>My desired result is:</p>
  
  <pre><code>username    point    avg_time
  demo123      100        60
  demo123456   100       100
  demo         90        120
  </code></pre>
  
  <p>I tried many times with different queries but the result is still wrong. Could you give me some solutions?</p>
  
  <p>Thanks in advance!</p>