I have a hierarchical database structure, for example. columns IDand PARENT_IDdefined for each row, with top level rows having NULL PARENT_ID.
I have all the relationships from this table flattened into another table, for example. if in one hierarchy of the ancestor, parent, grandson there were three records, there would be 3 records:
**ANCESTOR, DESCENDANT**
grantparent, parent
grandparent, grandchild
parent, grandchild
Instead of executing a hierarchical query to determine that the grandson is a descendant of grandparents, I can simply check for an entry (grandparent, grandchild)in this flattened table.
My question is that using this flattened table, I can most efficiently return all records that are between two nodes. Using an example, with grandparentand grandchildas my parameters, how can I return a record (grandparent, parent).
I do not want to use a hierarchical query to solve this problem ... I wonder if it is possible to do this without any connections.
source
share