title: Using a DISTINCT clause to filter data but still pull other fields that are not DISTINCT
body: <p>I am trying to write a query in Postgresql that pulls a set of ordered data and filters it by a distinct field.  I also need to pull several other fields from the same table row, but they need to be left out of the distinct evaluation.  example: </p>
  
  <pre><code>  SELECT DISTINCT(user_id) user_id, 
           created_at 
      FROM creations 
  ORDER BY created_at   
     LIMIT 20
  </code></pre>
  
  <p>I need the <code>user_id</code> to be <code>DISTINCT</code>, but don't care whether the created_at date is unique or not.  Because the created_at date is being included in the evaluation, I am getting duplicate <code>user_id</code> in my result set.</p>
  
  <p>Also, the data must be ordered by the date, so using <code>DISTINCT ON</code> is not an option here.  It required that the <code>DISTINCT ON</code> field be the first field in the <code>ORDER BY</code> clause and that does not deliver the results that I seek.</p>
  
  <p>How do I properly use the <code>DISTINCT</code> clause but limit its scope to only one field while still selecting other fields?</p>