[PLUG] Delete duplicate entries in MySQL
Don Buchholz
don at truedisk.com
Mon Jul 29 21:25:48 UTC 2002
Matt Alexander wrote:
>
> Does anyone know how to delete duplicate entries in a MySQL table?
>
> I can use "distinct" to select unique values, but I'd like to remove the
> duplicates entirely from the table.
> Thanks,
> ~M
>
Is the "LIMIT" qualifier what you're looking for?
e.g.
DELETE FROM table WHERE (condition) LIMIT n;
So if you have 8 duplicate entries, then you use n=7.
(I think -- test on a database copy first :-) )
- Don
More information about the PLUG
mailing list