Skip to content

Instantly share code, notes, and snippets.

@bfintal
Created February 25, 2020 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfintal/65b079c67a888836217244446df466f4 to your computer and use it in GitHub Desktop.
Save bfintal/65b079c67a888836217244446df466f4 to your computer and use it in GitHub Desktop.
Remove duplicate entries in MySQL table when you have no unique IDs. Change `mytable` to the name of your table.
CREATE TABLE `temp` like `mytable`;
INSERT `temp` SELECT DISTINCT * FROM `mytable`;
DROP TABLE `mytable`;
ALTER TABLE `temp` RENAME `mytable`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment