I have a dataset in which duplicate IDs were made for some records. There are never more than two records that share the same ID.
I am wondering, is it possible to re-number one of the two duplicate IDs in each duplicate set by finding out what the max ID number is for the entire dataset, and adding one to that number? And can this be done sequentially (i.e. one ID is renumbered, so the next ID that gets renumbered is one greater than the previous re-numbered ID)?
Here's the code I've come up with so far, but it doesn't work as desired. Column name with the duplicates = 'internalno'. There are 73 total columns in this dbf.
- Code: Select all
UPDATE "D:\aggregate\PAW.DBF" SET internalno= (SELECT MAX(internalno) FROM "D:\aggregate\PAW.DBF")+1 WHERE (
SELECT internalno , COUNT(internalno )
FROM "D:\aggregate\PAW.DBF"
GROUP BY internalno
HAVING ( COUNT(internalno ) > 1) )
In total, there are 3,171 duplicate records out of 352,794 records. That's why I'm really hoping this can be automated.
If you can help, please let me know. Thanks!
Brian