title: MySQL Select Group of Records Based on latest timestamp
body: <p>I have a routine that runs every few hours that creates several entries in a table used for logging.  What I need to do is select all the records with the most recent <strong>timestamp</strong> that have a common account id. Something like this:</p>
  
  <pre><code>SELECT * 
  FROM TABLE_logs 
  WHERE ACCOUNT_ID='12345' 
  ORDER BY TIMESTAMP DESC 
  </code></pre>
  
  <p>Where I'm stuck is that I can't say <code>LIMIT 5</code> or something like that because the number of records created at each routine interval could be different. So, for example, when the routine runs at 10AM, it may create 6 table entries and only 4 table entries at 2PM.</p>
  
  <p>Is there a way to select the grouping of the latest records without knowing how many there are?</p>