Skip to content

Instantly share code, notes, and snippets.

@IdrisDose
Created August 3, 2018 08:28
Show Gist options
  • Save IdrisDose/92ea969215a23947ad086a76e75e94b3 to your computer and use it in GitHub Desktop.
Save IdrisDose/92ea969215a23947ad086a76e75e94b3 to your computer and use it in GitHub Desktop.
Quick MySQL fixing duplicate column
-- step 1
CREATE TABLE source_temp
LIKE source;
-- step 2
INSERT INTO source_temp
SELECT *
FROM source
GROUP BY <COLUMN>;
-- step 3
DROP TABLE source;
ALTER TABLE source_temp
RENAME TO source;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment