mysql - Delet just one record of duplicate -
i trying delete e-mail duplicates table nlt_user query showing correctly records having duplicates:
select [e-mail], count([e-mail]) nlt_user group [e-mail] having count([e-mail]) > 1
now how can delete records having duplicate one? thank you
try :
delete n1 nlt_user n1 inner join nlt_user n2 on n1.e-mail=n2.e-mail , n1.id>n2.id;
this keep record minimum id value of duplicates , deletes remaining duplicate records
Comments
Post a Comment