title: SELECT only one entry of multiple occurrences
body: <p>Let's say I have a Table that looks like this:</p>
  
  <pre>
  id fk value
  ------------
  1  1  'lorem'
  2  1  'ipsum'
  3  1  'dolor'
  4  2  'sit'
  5  2  'amet'
  6  3  'consetetur'
  7  3  'sadipscing' 
  </pre>
  
  <p>Each <strong>fk</strong> can appear multiple times, and for each <strong>fk</strong> I want to select the last row (or more precise the row with the respectively highest id) – like this:</p>
  
  <pre>
  id fk value
  ------------
  3  1  'dolor'
  5  2  'amet'
  7  3  'sadipscing' 
  </pre>
  
  <p>I thought I could use the keyword <code>DISTINCT</code> here like this:</p>
  
  <pre><code>SELECT DISTINCT id, fk, value 
  FROM table
  </code></pre>
  
  <p>but I am not sure on which row <code>DISTINCT</code> will return and it must be the last one.
  Is there anything like (<em>pseudo</em>)</p>
  
  <pre><code>SELECT id, fk, value 
  FROM table 
  WHERE MAX(id) 
  FOREACH DISTINCT(fk)
  </code></pre>
  
  <p>I hope I am making any sense here :)
  thank you for your time</p>