selfish
11/15/2015 - 4:07 PM

Delete duplicates MySQL table, leaving one row for each duplicate group

Delete duplicates MySQL table, leaving one row for each duplicate group

DELETE `t1`
FROM `table` `t1`
INNER JOIN `table` `t2` 
   ON `t1`.`dup_col1` = `t2`.`dup_col1`
	AND `t1`.`dup_col2` = `t2`.`dup_col2`
	# AND...
WHERE `t1`.`primary_key` > `t2`.`primary_key`