dabempire Posted June 24, 2008 Share Posted June 24, 2008 I have a script that is a links directory. It has quite a few duplicates in the database. What can I use to delete the duplicates? Here is the database info. database: links row: my_links column with duplicate entries: link I need to run it so that if X exists >1 time to remove all but 1. Thanks a ton for any help. Link to comment https://forums.phpfreaks.com/topic/111697-how-can-i-delete-duplicate-entries-from-my-database/ Share on other sites More sharing options...
ag3nt42 Posted June 24, 2008 Share Posted June 24, 2008 I'm not sure how you can delete all but one but you could just delete them all and then right afterwards put it back in. Link to comment https://forums.phpfreaks.com/topic/111697-how-can-i-delete-duplicate-entries-from-my-database/#findComment-573325 Share on other sites More sharing options...
PFMaBiSmAd Posted June 24, 2008 Share Posted June 24, 2008 http://www.xaprb.com/blog/2006/10/11/how-to-delete-duplicate-rows-with-sql/ Link to comment https://forums.phpfreaks.com/topic/111697-how-can-i-delete-duplicate-entries-from-my-database/#findComment-573332 Share on other sites More sharing options...
bluejay002 Posted June 26, 2008 Share Posted June 26, 2008 first off, you won't have duplicate entries if you have your database normalized enough to meet your needs. And even if with the key, still duplicates exist.... then you can delete it by deleting the entry through an ID. other than that, you can use ag3tn42's suggestion since not a column was unique there in. Link to comment https://forums.phpfreaks.com/topic/111697-how-can-i-delete-duplicate-entries-from-my-database/#findComment-574725 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.