title: How to retrieve the most recent records for all ids when grouped by date
body: <p>I need a mysql query that will take the most recent record for each of my ids when grouped by date even if the record isn't associated with the date. I am not sure if this is possible with mysql but I appreciate any help you can give.</p>
  
  <p>For example, let's say I have the following table:</p>
  
  <pre><code>user_id | total | timestamp
  ----------------------------
     1    |   -15 | jan 1
     2    |    -5 | jan 1
     3    |   -10 | jan 1
     1    |    -4 | jan 2
     3    |   -16 | jan 3
  </code></pre>
  
  <p>I would like it to return the following table:</p>
  
  <pre><code>user_id | total | timestamp
  ----------------------------
     1    |   -15 | jan 1
     2    |    -5 | jan 1
     3    |   -10 | jan 1
     1    |    -4 | jan 2
     2    |    -5 | jan 2
     3    |   -10 | jan 2
     1    |    -4 | jan 3
     2    |    -5 | jan 3
     3    |   -16 | jan 3
  </code></pre>
  
  <p>Please let me know if you need additional clarification.
  Thanks for your help.</p>