I posted in the past a request to joing all hierarchy based on a Parent-Child relationship.
Here is the link to old post.
Now I need something similar but slightly different. Instead of joining all hierarchy, I need to return the only ID when a condition match.
Let’s say that besides Parent and Child columns we have a third column “Type”. Than I only need to return the single ID when Type = x, for example.
Hope the picture below make it more clear.
here is the data.
Child Parent Child Type
1578123 A
10000176 1578123 B
10000623 10000176 C
1584885 10000623 D
1606217 1584885 E
44000026 10000623 D
81003755 10000623 D
1579066 1578123 B
1603212 1579066 C
81014694 1603212 D
1603645 1579066 C
59000184 1579066 C
81011826 59000184 D
81017364 59000184 D
81014130 1579066 C
81020541 1579066 C
81020078 81020541 D