Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the root node for a child using connect by prior

500237Jan 11 2011 — edited Mar 4 2011
Hi,

I searched at many places to do this but not able to get the exact o/p sp posting my question here.

I have a table with parent_id and child_id columns. The levels of this parent_child can be many but my aim is to find the ultimate parent ( dont know the right term)
like if I have a child_node= xyz and its parent= pqr and its parents=lmn which might be ultimate parent which doesnt have any further parent.

So if i start with child_code= "xyz" then i should get the parent as "lmn" and not the immediate parent "pqr".

Please help.

Thanks,
Aashish
This post has been answered by Sayan Malakshinov. on Jan 11 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2011
Added on Jan 11 2011
9 comments
7,370 views