title: Remove older records from table
body: <p>I'm trying to import product data from different sellers, the data is imported to an import table with the following fields:
  id=auto increment
  sellerid=key to seller
  sellerproductid=the product id a seller gives to a product
  lastupdate=the date that this item is updated</p>
  
  <p>So seller A can have Product id 22 witch is the same product as seller B having product id 55.</p>
  
  <p>When seller A changes the price of product A there will be a line in the import. I currently have many "historical" lines and am only interested in getting the most current of the import</p>
  
  <p>For example:</p>
  
  <pre><code>1  A   22     2012 01 22
  2  A   22     2012 05 10
  44 A   22     2012 11 10
  </code></pre>
  
  <p>I would like to archive the first 2 lines like so:</p>
  
  <pre><code>insert into archive ....
  values ( select * from import where id in(
   select id from import 
   where `lastupdate` &lt; max(`lastupdate`)
   group by sellerid, sellerproductid
  )
  </code></pre>
  
  <p>I'm having trouble finding the right mysql statement to get the id's of the older records.</p>