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 - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -