Skip to content

Instantly share code, notes, and snippets.

@uovidiu
Created August 19, 2013 14:33
Show Gist options
  • Select an option

  • Save uovidiu/6269799 to your computer and use it in GitHub Desktop.

Select an option

Save uovidiu/6269799 to your computer and use it in GitHub Desktop.
mysql search duplicates mysql remove duplicates
// search duplicates
SELECT field, field_1, count(*)
FROM table
GROUP BY field, field_1 HAVING count(*) > 1;
//remove duplicates
ALTER IGNORE TABLE `sometable` ADD UNIQUE INDEX(field,field_1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment