Delete duplicate data records in mysql database

  • 2020-05-06 11:48:19
  • OfStack

The following method is used to delete, assuming that the duplicate is the title field
in the test database  

create table bak as (select * from test group by title having count(*)=1);      
insert into bak (select * from test group by title having count(*)>1);         
truncate table test;         
insert into test select * from bak; 

Related articles: