How to get all ancestors

Giganews Newsgroups
Subject: How to get all ancestors
Posted by:  Steve (sprob…@yahoo.com)
Date: 27 Apr 2004

I am new to the use of "connect by prior".  I have a standard parent
child table (id, parentId) where the data graphically might look like
this:

Great Grandpa
....Grandpa
.......Dad
..........Son

Using connect by prior (or otherwise), I would like to find all the
ancestors nodes for son (grouped by son).  I don't want the tree
flattened into one row as SYS_CONNECT_BY_PATH does.

Rather, I would like the resultset grouped:
-------------------------------------
Son    Dad
Son    Grandpa
Son    Great Grandpa

Is there a way to do this with 'connect by prior'?

Replies