title: SQL to get max value from each group
body: <p>Say I have a table</p>
  
  <p>Table Plays</p>
  
  <pre><code>date     | track_id  | user_id | rating
  -----------------------------------------
  20170416 | 1         | 1       | 3  (***)
  20170417 | 1         | 1       | 5
  20170418 | 2         | 1       | 1
  20170419 | 3         | 1       | 4
  20170419 | 3         | 1       | 2  (***)
  20170420 | 1         | 2       | 5
  </code></pre>
  
  <p>What I want to do is for each unique track_id, user_id I want the highest rating row.  I.e. produces this the table below where (***) rows are removed.</p>
  
  <pre><code>20170417 | 1         | 1       | 5
  20170418 | 2         | 1       | 1
  20170419 | 3         | 1       | 2
  20170420 | 1         | 2       | 5
  </code></pre>
  
  <p>Any idea what a sensible SQL query is to do this?</p>