mikedag Posted October 21, 2009 Share Posted October 21, 2009 Hi, I am working with a "directory" site that I did not originally develop... The database contains roughly 50,000 records and out of the 50,000 roughly 20,000 are in a sense, duplicates... Each user(row) was listed under a "category" and the table holding them only had one column for "categoryid".... The problem is that if the user wanted to be listed under a different category the record was duplicated and the only things that changed was the "categoryid", and of course the row "ID".... I have modified scripts and the table to now hold multiple categoryid's so that the record only needs to be entered once and will show under multiple categories.... The problem i'm facing is, is there any easier way than doing it manually to merge the categoryid's into one row and remove the duplicate records? For example, say the original rows looks like this: ID | NAME | INFO | CATEGORYID1 and the new ones look like this: ID | NAME | INFO | CATEGORYID1 | CATEGORYID2 | CATEGORYID3 How can I grab one of the originals and then take and move the other duplicates categoryid's into CATEGORY2, CATEGORY3? I know this was probably extra confusing... Welcome to the club! I'm so confused I'm pulling out the little hair I have left! Mike Quote Link to comment https://forums.phpfreaks.com/topic/178473-merging-duplicates/ Share on other sites More sharing options...
Mchl Posted October 21, 2009 Share Posted October 21, 2009 Stop right there! Your new design is not that good and can be improved. Read this first: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html Quote Link to comment https://forums.phpfreaks.com/topic/178473-merging-duplicates/#findComment-941181 Share on other sites More sharing options...
mikedag Posted October 21, 2009 Author Share Posted October 21, 2009 lol... I knew this would come up Even using a separate table... I'm stumped! Quote Link to comment https://forums.phpfreaks.com/topic/178473-merging-duplicates/#findComment-941202 Share on other sites More sharing options...
Mchl Posted October 21, 2009 Share Posted October 21, 2009 Hey. It's not that difficult, and it makes your life sooo much easier afterwards. Quote Link to comment https://forums.phpfreaks.com/topic/178473-merging-duplicates/#findComment-941215 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.