MySQL Удалить дубликаты
DELETE c1 FROM tablename c1
INNER JOIN tablename c2
WHERE
c1.id > c2.id AND
c1.unique_field = c2.unique_field;
Matteoweb
DELETE c1 FROM tablename c1
INNER JOIN tablename c2
WHERE
c1.id > c2.id AND
c1.unique_field = c2.unique_field;
DELETE FROM NAMES
WHERE id NOT IN (SELECT *
FROM (SELECT MIN(n.id)
FROM NAMES n
GROUP BY n.name) x)