I need to modify a program and can't wrap my brain around how to do it. The program splits percentage spreads based on codes for a person. Sometimes the same code may show up twice and the program inserts two entries for the table for that code with two different percentages instead of combining them. It reads one at a time figures the percentage and adds it to the table.
I can go back and find them - would like like this
Code Percentage UniqueID
123 15 12345
124 10 12346
123 75 12347
I would either like to do it before the initial insert or go back and update and not sure how to do it.
It should look like this
Code Percentage UniqueID
123 90 12345
124 10 12346
I was thinking to build two cursors and loop through the top one to insert into the table and loop through the second one looking for the duplicates. But I don't know if I can delete the found duplicate within the cursor? ... or is there a better way of doing it.
Any help would be greatly appreciated.
I can go back and find them - would like like this
Code Percentage UniqueID
123 15 12345
124 10 12346
123 75 12347
I would either like to do it before the initial insert or go back and update and not sure how to do it.
It should look like this
Code Percentage UniqueID
123 90 12345
124 10 12346
I was thinking to build two cursors and loop through the top one to insert into the table and loop through the second one looking for the duplicates. But I don't know if I can delete the found duplicate within the cursor? ... or is there a better way of doing it.
Any help would be greatly appreciated.