Posts

Showing posts from November, 2012

MySQL Delete dupes

My favorite way of deleting dupes (taken from the honorable #mysql on freenode) If you have a unique ID and the name may contain duplicates then DELETE t1 FROM table1 AS t1 JOIN table1 AS t2 ON t1.id>t2.id AND t1.name=t2.name; If you have other fields that need to be taken into consideration extend the join as needed. If it fails on a myisam table see http://bugs.mysql.com/bug.php?id=28837