title: How can I delete row(s) with duplicate row_id but different date field values in a single table?
body: <p>mysql - How can I delete row(s) with duplicate 'row_id' but different 'recd_date' field values in a single table, leaving only the row with the most recent'recd_date'? </p>
  
  <p>Tried script below...</p>
  
  <pre><code>DELETE FROM table1 
  WHERE table1.id = table1.id 
  AND table1.recd_date &lt; table1.recd_date;
  </code></pre>
  
  <p>...but it deletes all records in the table, which logically, I can understand.  But I feel like there should be a pretty simple and straight forward solution to this.</p>
  
  <p>The images below are examples of what exists and the desired results..</p>
  
  <p>example of existing table data</p>
  
  <pre><code>doc_id recd_date  recd_amount update_date
      72 2015-01-01        6000 2015-04-30
      72 2015-01-01        6000 2015-02-30
      12 2013-02-01        5000 2015-08-31
      12 2013-02-01        5000 2014-08-31
      12 2013-02-01        5000 2013-06-30
  </code></pre>
  
  <p>example of desired result</p>
  
  <pre><code>doc_id recd_date  recd_amount update_date
      72 2015-01-01        6000 2015-04-30
      12 2013-02-01        5000 2015-08-31
  </code></pre>