Basically, I need to fix a table that contains a hierarchy.Currently the table contains bad data that looks like this.Table:SubmissionTxnDate SubmissionId OrigSubmissionId AgrId2004-11-10 23065284 Null 5002004-11-11 93785699 23065284 5002004-11-12 94569457 23065284 5002004-11-13 96175712 23065284 5002004-11-14 97540926 23065284 5002007-07-01 95894194 Null2007-07-02 101168819 95894194 504 2007-07-03 101220089 95894194 504
What I need to do is update the submission table so that the bad records look like the following. 2004-11-10 23065284 Null2004-11-11 93785699 23065284 5002004-11-12 94569457 93785699 500 2004-11-13 96175712 94569457 500 2004-11-14 97540926 96175712 5002007-07-01 95894194 Null2007-07-02 101168819 95894194 5042007-07-03 101220089 101168819 504
Thus far I have managed to identify all the records in the Submission table that have dups and I have a temp table with this information. #dupsOrigSubmissionId DupCount AgrId23065284 4 50095894194 2 504
Thanks for any help you can provide.