lilmer Posted April 23, 2014 Share Posted April 23, 2014 Good day, I want to know if I can save the first entry and delete the remaining duplicate enty.This is what I did to get all the records with duplicate entry SELECT a.*, b.totalCount AS Duplicate FROM table a INNER JOIN ( SELECT email, COUNT(*) totalCount FROM psuser GROUP BY email HAVING COUNT(*) >= 2 ) b ON a.email = b.email ORDER BY a.email,a.userId Sample record result ID , EMAIL 100 , A 101 , A 102 , A 200 , B 222 , B 235 , C 262 , C 276 , D 278 , D 300 , E 301 , E 302 , E 305 , E Don't delete the first entry and delete all those remaining. Can I do that? Quote Link to comment https://forums.phpfreaks.com/topic/287967-save-first-record-delete-remaining-duplicate-record/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.