Entry No. is a unique Number. Entry nos 1 to 3 are staring numbers, the balance are linked numbers,. for eg. entry no 8 is linked to 7 which in turn is linked to 4, which in turn is linked to 1. Because there is no reference against 1, it is the the starting number
i wanted the results as below:
Entry No.
Reference No.
Document No.
8
1
AAA
For entry no. 8, the links end at entry no. 1 and corresponding reference against 1 is AAA.
i got the output as required in the attachment.
Now i have made a small change.
Entry No.
Reference No.
Document No.
1
AAA
2
BBB
3
CCC
4
1
DDD
5
2
EEE
6
2
FFF
7
4
GGG
8
7
HHH
in the above table, for entry 5 and 6, the reference number is the same.