Re: SQL help requested - "linked list"

From: Mia <nospam_at_cox.net>
Date: Fri, 22 Aug 2003 16:07:20 -0700
Message-ID: <3F46A228.8010004_at_cox.net>


Thanks everybody (esp. Mikito)!

Using the "connect by" construct does the trick. The information about using "connect by" talks about family tree and other hierarchies. Basically my linked list scenario can be treated as one. It's just a hierarchy with nodes but no branches.

Using the example that Lennart graciously provided, the Oracle version goes like this:

To go down the list:

select id from list
start with id = 3
connect by prior id = nextid;

and up the list:

select id from list
start with id = 3
connect by id = prior nextid;

Just what I needed! Thanks again.

-Mia Received on Sat Aug 23 2003 - 01:07:20 CEST

Original text of this message