Oracle hierarchical query join to selection of all decendants -
i trying retrieve list of each descendant each item. not sure making sense, try , explain.
example data:
id | pid -------- 1 | 0 2 | 1 3 | 1 4 | 1 5 | 2 6 | 2 7 | 5 8 | 3
etc...
the desired results are:
id | decendant -------------- 1 | 1 1 | 2 1 | 3 1 | 4 ... 2 | 2 2 | 5 2 | 6 2 | 7 3 | 3 3 | 8
etc...
this being achieved using cursor move through data , inserting each descendant table , selecting them.
i wondering if there better way these, there must way right query bring desired results.
if 1 has ideas, or has figured out before appreciated. ordering not important, nor 1 - 1, 2 -2 reference. cool have it, not crucial.
select connect_by_root(id) id, id decendant table1 connect prior id = pid order 1, 2
Comments
Post a Comment