I have a table like this:
I want to output the hierarchy like this:
a - c - x1
a - c - x2
a - d - y1
a - d - y2
b - e - z
b - f - q
I searched a little for CTE examples, but they list only a (2,2)-combination of the hierarchy. How can I achieve this result without depending on the parent-child depth?