title: MySQL - Select unique column with max timestamp
body: <p>I'm trying to prepare a query and I'm having a hard time with it. I need some MySQL gurus to help please...</p>
  
  <p>Take the following table as an example...</p>
  
  <p><code>
  CREATE TABLE <code>order_revision</code> (
    <code>id</code> int(11) NOT NULL,
    <code>parent_order_id</code> int(11) NOT NULL,
    <code>user_id</code> int(11) DEFAULT NULL,
    <code>sub_total</code> decimal(19,4) NOT NULL DEFAULT '0.0000',
    <code>tax_total</code> decimal(19,4) NOT NULL DEFAULT '0.0000',
    <code>status</code> smallint(6) NOT NULL DEFAULT '1',
    <code>created_at</code> int(11) NOT NULL,
    <code>updated_at</code> int(11) DEFAULT NULL
  )
  </code></p>
  
  <p>I need a query to select all unique 'parent_order_id' with the max 'updated_at' value. This query should return all rows that have unique 'parent_order_id's based on the max timestamp of the 'updated_at' column. </p>
  
  <p>In other words, each row returned should have an unique 'parent_order_id' and be the maximum timestamp of the'updated_at' column.</p>
  
  <p>Basically this query would find the latest "order revision" for each "parent order"</p>