title: How to select single row based on the max value in multiple rows
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2657482/sql-find-the-max-record-per-group">SQL: Find the max record per group</a>  </p>
  </blockquote>
  
  
  
  <p>I have a table with four columns as such:</p>
  
  <pre><code>name   major    minor  revision
  p1     0        4      3
  p1     1        0      0
  p1     1        1      4
  p2     1        1      1
  p2     2        5      0
  p3     3        4      4
  </code></pre>
  
  <p>This is basically ca table containing records for each version of a program.  I want to do a select to get all of the programs and their latest version so the results would look like this:</p>
  
  <pre><code>name   major    minor  revision
  p1     1        1      4
  p2     2        5      0
  p3     3        4      4
  </code></pre>
  
  <p>I can't just group by the name and get the max of each column because then i would just end up with the highest number from each column, but not the specific row with the highest version.  How can I set this up?</p>