title: max(), group by and order by
body: <p>I have following SQL statement.</p>
  
  <pre><code>    SELECT t.client_id,max(t.points) AS "max" FROM sessions GROUP BY t.client_id;
  </code></pre>
  
  <p>It simply lists client id's with maximum amount of points they've achieved. Now I want to sort the results by max(t.points). Normally I would use ORDER BY, but I have no idea how to use it with groups. I know using value from SELECT list is prohibited in following clauses, so adding ORDER BY max at the end of query won't work.</p>
  
  <p>How can I sort those results after grouping, then?</p>
  
  <p>Best regards</p>