title: How to select the most recent set of dated records from a mysql table
body: <p>I am storing the response to various rpc calls in a mysql table with the following fields:</p>
  
  <pre><code>Table: rpc_responses
  
  timestamp   (date)
  method      (varchar)
  id          (varchar)
  response    (mediumtext)
  
  PRIMARY KEY(timestamp,method,id)
  </code></pre>
  
  <p>What is the best method of selecting the most recent responses for all existing combinations of <code>method</code> and <code>id</code>?</p>
  
  <ul>
  <li><p>For each date there can only be one response for a given method/id.</p></li>
  <li><p>Not all call combinations are necessarily present for a given date.</p></li>
  <li><p>There are dozens of methods, thousands of ids and at least 365 different dates </p></li>
  </ul>
  
  <p>Sample data:</p>
  
  <pre><code>timestamp  method  id response
  2009-01-10 getThud 16 "....."
  2009-01-10 getFoo  12 "....."
  2009-01-10 getBar  12 "....."
  2009-01-11 getFoo  12 "....."
  2009-01-11 getBar  16 "....."
  </code></pre>
  
  <p>Desired result:</p>
  
  <pre><code>2009-01-10 getThud 16 "....."
  2009-01-10 getBar 12 "....."
  2009-01-11 getFoo 12 "....."
  2009-01-11 getBar 16 "....."
  </code></pre>
  
  <p>(I don't think <a href="https://stackoverflow.com/questions/189213/sql-selecting-rows-by-most-recent-date">this</a> is the same question - it won't give me the most recent <code>response</code>) </p>