Hi,
Below is the loop requirement .
Based on id and parent id , column new_pid need to be calculated . id can go upto thousands .
| id | code | parent id | new pid |
| 1 | V01 | 0 | 0 |
| 2 | V02 | 1 | V01 |
| 3 | V03 | 2 | V01,V02 |
| 4 | V04 | 5 | V03,V02 |
| 5 | V05 | 3 | V01 |
Any help is appreciated. Thanks.