Joinkey or Sort find the Parent company
Posted: Tue May 17, 2022 8:27 pm
Hi All,
I would like to perform below task using joinkey or Sort.
I am trying to find the Ultimate parent company.
Example :
Input file:
Expected output file:
Basically Company and Immediate parent company are same ,then it can be considered as Ultimate parent company.
and if Company and Immediate parent company not same then ,need to search in Company field column using the Immediate Parent company value
to find the ultimate parent company
I would like to perform below task using joinkey or Sort.
I am trying to find the Ultimate parent company.
Example :
Input file:
Company Immediate Parent Company
A A
B A
C A
D B
E B
F E
G E
Z Z
A A
B A
C A
D B
E B
F E
G E
Z Z
Expected output file:
Company Immediate Parent Company Ultimate Parent Company
A A A
B A A
C A A
D B A
E B A
F E A
G E A
Z Z Z
A A A
B A A
C A A
D B A
E B A
F E A
G E A
Z Z Z
Basically Company and Immediate parent company are same ,then it can be considered as Ultimate parent company.
and if Company and Immediate parent company not same then ,need to search in Company field column using the Immediate Parent company value
to find the ultimate parent company