I have the following table:
+----+---------+----------------+ | ID | COMPANY | PARENT_COMPANY | +----+---------+----------------+ | 1 | A | X | | 2 | B | Y | | 3 | C | Z | | 4 | D | A | | 5 | E | D | +----+---------+----------------+
I need to retrieve the a certain company and all descendants regardless how many they are and how many levels they expand.
For example, the company A has the child D which in turn has the child E and so forth. I want to show all these companies in one column.
I tired self-join, but I think it the number of levels is fixed. I checked the ORACLE related questions here, and I found this but the number of levels is restricted.
connect bycan handle an unlimited number of levels.connect bycapabilities.