Mysql query to delete duplicate row in database table

Database table with duplicate records:

duplicate table data

MySQL Query to delete duplicates:

DELETE c1 FROM companies c1, companies c2 WHERE c1.company_id > c2.company_id AND c1.company_name = c2.company_name;

After delete:

MySQL query to delete duplicate
Unique data after removed duplicates

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *