Skip to content

Instantly share code, notes, and snippets.

@perminder-klair
Created December 6, 2013 16:34
Show Gist options
  • Save perminder-klair/7827832 to your computer and use it in GitHub Desktop.
Save perminder-klair/7827832 to your computer and use it in GitHub Desktop.
Duplicate row
CREATE TEMPORARY TABLE tmptable_1 SELECT * FROM your_table WHERE primarykey = '1';
UPDATE tmptable_1 SET primarykey = NULL;
INSERT INTO your_table SELECT * FROM tmptable_1;
DROP TEMPORARY TABLE IF EXISTS tmptable_1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment