title: Group by names desc - get last entered values for a grouped name
body: <p>I have an table like that:</p>
  
  <pre><code>id | name | v (lvl)
  11 | Jane | 6
  12 | John | 5
  13 | Jane | 6
  14 | John | 5
  15 | Jane | 7
  16 | Jane | 5 
  </code></pre>
  
  <p>In my autocomplete form now id like to group the names but get the last value (value with biggest id). In the example above would be </p>
  
  <pre><code>Jane | 5
  </code></pre>
  
  <p>I tried with combinations like distinct, group by, order by. But im always get</p>
  
  <pre><code>Jane | 6 
  </code></pre>
  
  <p>or grouped like this and reversed:</p>
  
  <pre><code>Jane | 6 
  Jane | 7 
  Jane | 5 
  </code></pre>
  
  <p>I would need something like this:</p>
  
  <pre><code>SELECT name,lvl FROM
  (
  SELECT DISTINCT name, lvl FROM pora WHERE name LIKE 'Jane' ORDER BY lvl DESC
  )
  GROUP BY name
  </code></pre>
  
  <p>EDIT: I won't get the highest lvl, i want get the lvl of the highest id, grouped by name. Thats all. My example above would be the best explanation what i like to get.<br/>
  In the inner query i change the order to DESC for all and in the outer i group it by names. But i get an error for this. </p>
  
  <p><strong>EDIT 2</strong> I finally did at my own. The correct solution (i was already close):</p>
  
  <pre><code>SELECT a.name, a.lvl FROM
  (
  SELECT DISTINCT name, lvl FROM pora WHERE name LIKE 'Jane' ORDER BY id DESC
  )as a
  GROUP BY name
  </code></pre>