Comment

Your Awesome Drone Movie of the Day: Superman With a GoPro

241
Vicious Babushka3/19/2014 7:08:48 pm PDT

re: #205 CuriousLurker

>OT: Are there any database people here?

I’m cleaning up a MySQL database table that has some duplicate entries, namely inventory ID (inv_id) numbers for 600+ records. About 2/3 of the records are also for the same company—i.e. they are (or were, until they got updated by the client)—exact duplicates. For those, I’ve already confirmed that I can safely delete the one with the older contract expiration date.

For the others, the inv_id numbers are the same, but are for different companies. Those are going to need new numbers so that the correct record will come up when the client wants to update it. Can I manually renumber these, or would it be more practical to just drop the inv_id field for that table and then recreate it and figure out how to automatically repopulate it as an auto incrementing primary key?

BTW, for some reason the inv_id is no longer a primary key. I’m not sure how that happened unless it was when I was merging an old backed-up table with a new one… Anyway, any advice and/or warnings about potential gotchas would be greatly appreciated.

I would do a SELECT DISTINCT to get the unique ID’s and load them into a new table.