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

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - ASP.NET Core 1.0. Bearer Token, cannot access custom claims -