title: Duplicate / Copy records in the same MySQL table
body: <p>I have been looking for a while now but I can not find an easy solution for my problem. I would like to duplicate a record in a table, but of course, the unique primary key needs to be updated.</p>
  
  <p>I have this query:</p>
  
  <pre><code>INSERT INTO invoices
      SELECT * FROM invoices AS iv WHERE iv.ID=XXXXX
      ON DUPLICATE KEY UPDATE ID = (SELECT MAX(ID)+1 FROM invoices)
  </code></pre>
  
  <p>the problem is that this just changes the <code>ID</code> of the row instead of copying the row. Does anybody know how to fix this ?</p>
  
  <p>//edit: I would like to do this without typing all the field names because the field names can change over time.</p>