title: Get id of max value in group
body: <p>I have a table and i would like to gather the id of the items from each group with the max value on a column but i have a problem.</p>
  
  <pre><code>SELECT group_id, MAX(time) 
  FROM mytable
  GROUP BY group_id
  </code></pre>
  
  <p>This way i get the correct rows but i need the id:</p>
  
  <pre><code>SELECT id,group_id,MAX(time)
  FROM mytable
  GROUP BY id,group_id
  </code></pre>
  
  <p>This way i got all the rows. How could i achieve to get the ID of max value row for time from each group?</p>
  
  <p>Sample Data</p>
  
  <pre><code>id = 1, group_id = 1, time = 2014.01.03
  id = 2, group_id = 1, time = 2014.01.04
  id = 3, group_id = 2, time = 2014.01.04
  id = 4, group_id = 2, time = 2014.01.02
  id = 5, group_id = 3, time = 2014.01.01
  </code></pre>
  
  <p>and from that i should get id: 2,3,5
  Thanks!</p>