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 find Last Child (Node) of a parent

507047Sep 1 2008 — edited Sep 1 2008
Hi All

I have following data:

PARENT CHILD
1 2
2 3
3 4
4 5
100 101
101 102
200 201
300 301
301 302
302 303
303 304

Now I need the output as below:

Parent Final Child
1 5
100 102
200 201
300 304

Which means, for the parent, it should start with immediate child and traverse through all subsequent parent-child relation ship and should find at ending with the last child for that group.

When the parent child relation is as below: i need to output 1 (first parent in the group) & 5 (last child in the group)

1 - 2 - 3 - 4 - 5

Quick solution could be helpful.


Thanks in advance,
Ram.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2008
Added on Sep 1 2008
10 comments
940 views