To remove the all the duplicate entries from a particular mysql table, use the below mysql query :
Step : 1
CREATE TABLE new_table AS SELECT * FROM old_table WHERE 1 GROUP BY [COLUMN TO remove duplicates BY];
What the above query does is, it will create a new table with the filtered data (all duplicate entries were deleted).
Note : replace the whole [COLUMN TO remove duplicates BY] with your column name
Step 2: After that delete the old table
DROP TABLE old_table;
Step 3 : rename the new table
RENAME TABLE new_table TO old_table;
Recent Comments