title: sql query: how to pick only 1 row with highest value of column2 after doing ORDER by on column1
body: <p>I've a table like:</p>
  
  <pre><code>col1,  col2,  col3
  8      6       xyz
  8      4       abc
  9      2       def
  4      3       ghi
  9      5       jkl
  </code></pre>
  
  <p>I'd like to write a query which picks highest value of col2 for each unique col1 value, i.e.</p>
  
  <pre><code>col1,  col2,  col3
  4      3      ghi
  8      6      xyz
  9      5      jkl
  </code></pre>
  
  <p>I know how to sort the table based on col1 see [1], but I don't know if there is an easy way to pick max col2 value without doing a JOIN. This needs to be run on a table with about 1Million rows.</p>
  
  <p>[1] <code>select col1,col2,col3 from table ORDER BY col1</code></p>