title: Mysql, delete all except for last entry
body: <p>I am migrating data from one MySQL Database to a NoSQL DB (like Mongo or something similar). What I have is something like this:</p>
  <pre><code> ------------------------
  | id | lead |   event    |
   ------------------------
  | 1  | 333  |  event1    |
   ------------------------
  | 3  | 333  |  event2    |
   ------------------------
  | 22 | 333  |  event3    |
   ------------------------
  | 9  | 111  |  event1    |
   ------------------------
  </code></pre>
  <p>what I want to do is delete delete all entries except for the last entry. So after the delete command I would be left with:</p>
  <pre><code> ------------------------
  | id | lead |   event    |
   ------------------------
  | 22 | 333  |  event3    |
   ------------------------
  | 9  | 111  |  event1    |
   ------------------------
  </code></pre>
  <p>I would like to mention that it's against MySQL8.0 some of the other <a href="https://stackoverflow.com/questions/315621/mysql-how-to-select-all-rows-from-a-table-except-the-last-one">solutions</a> I have <a href="https://stackoverflow.com/questions/19470230/sql-selecting-all-but-the-last-row-in-a-table">looked at</a> are 8+ years old and don't allow for some of the structures, while others don't work as expected, namely that they return all rows from the query</p>
  <p>also I am using a &quot;select&quot; statement to see if I can return the values before I delete</p>