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. Quote Link to comment 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. Quote Link to comment 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/ Quote Link to comment 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. Quote Link to comment 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.