Skip to content

Instantly share code, notes, and snippets.

@csalgueiro
Created November 15, 2016 12:25
Show Gist options
  • Save csalgueiro/eb4f530dedf70ee5a2cdb1e965af1ef4 to your computer and use it in GitHub Desktop.
Save csalgueiro/eb4f530dedf70ee5a2cdb1e965af1ef4 to your computer and use it in GitHub Desktop.
eliminar_duplicados MYSQL
CREATE TEMPORARY TABLE tabla_temporal AS
SELECT id
FROM tabla_original
GROUP BY campo_unico_1, campo_unico_2;
DELETE FROM tabla_original
WHERE id NOT IN(SELECT id FROM tabla_temporal);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment