title: SQL get all rows sorted without duplicates
body: <p>I have a table that looks something like this:</p>
  
  <pre><code>________________________
  |id|value|date|approved|
  -----------------------
  </code></pre>
  
  <p>What I need to be able to do is get each row where approved = 1. That part is obvious. For each occurrence of value, I only want the most recent row (sorted by date).</p>
  
  <p>Meaning that with a table like this:</p>
  
  <pre><code>________________________
  |id|value|date|approved|
  -----------------------
  |1 |Foo  | 5  |   1    |
  |2 |Bar  | 6  |   1    |
  |3 |Foo  | 8  |   1    |
  -----------------------
  </code></pre>
  
  <p>I only want the rows with id 2 and 3.</p>
  
  <p>I assume I need to use DISTINCT somehow, but I'm not sure how. Could anyone help me out here?</p>