Possible Duplicate:
How to delete duplicate records in mysql database?
there are duplicate rows in the mysql table. how find the duplicate rows and delete them.
Possible Duplicate:
How to delete duplicate records in mysql database?
there are duplicate rows in the mysql table. how find the duplicate rows and delete them.
My preferred solution:
How to delete duplicate records in mysql database?
In the future, use unique/primary keys to make sure this doesn't happen again.
Define the columns that you want to use to determine duplication and add a unique index on them.
ALTER IGNORE TABLE table_name ADD UNIQUE INDEX (c1,c2,c3);
This has the advantage of preventing future duplicates.
DELETE * ,count(*)as n FROM
addgroup by id HAVING n>1
.
It will delete all duplicate records