CaseNumber | PersonNumber | PersonType | ID | GroupID | State |
---|---|---|---|---|---|
13452400 | 134524 | Plaintiff | 1 | 10243 | NC |
13452400 | 2180207 | Defendant | 2 | 10243 | NC |
13452400 | 1320554 | Child | 3 | 10243 | NC |
13452402 | 134524 | Plaintiff | 4 | 10243 | AR |
13452402 | 38876453 | Defendant | 5 | 10243 | AR |
13452402 | 127673637 | Child | 6 | 10243 | AR |
14534301 | 38876453 | Plaintiff | 7 | 10243 | ID |
14534301 | 34276778 | Defendant | 8 | 10243 | ID |
14534301 | 98764356 | Child | 9 | 10243 | ID |
14534301 | 9808767 | Child | 10 | 10243 | ID |
I have huge data like that. Each case would have at least 3 people. One Person from one case may exists in multiple cases. child can be multiple. I can start loop for any person. If One PersonNumber from one case exists in any another case on any role then
1.I need to update the IterationID of Parent person to 1 and IterationParent to same PersonNumber based on whom another case found. 2. Update first occurred record IterationID to 2. and Iteration Parent to PersonNumber of found person.
Here I need to pick the PersonNumbers where IterationID 2 and continue the search in another case If another case found I need to update the IterationID to 2 and IterationParent to the PersonNumber of found person ID.
Please find attached expected result here.