I have an exciting task for you... I have a hierarchy structure in a database unloaded to a dataset. The data has the following layout:
...where the leftmost ID is the parent of the rightmost each ID. So, the top of each hierarchy is defined as an ID not present in the rightmost side, ie. the ID only has parent relations. There can be max. 9 levels in the hierarchy, and each ID is defined as ZD 20. Each ID can only be present in ONE hierarchy structure.
My requirement for output is a flat version of the hierarchy, meaning I need one record per top point of each hierarchy, including all the IDs that belongs to it. In the example given, the output would be: