I have the following SQL to delete duplicate values form a table,
DELETE p1
FROM `ProgramsList` p1, `ProgramsList` p2
WHERE p1.CustId = p2.CustId
AND p1.CustId = 1
AND p1.`Id`>p2.`Id`
AND p1.`ProgramName` = p2.`ProgramName`;
Id
is auto incremental
for a given CustId
ProgramName
must be unique (currently it is not)
The above SQL takes about 4 to 5 hours to complete with about 1,000,000 records
Could anyone suggest a quicker way of deleting duplicates from a table?