Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about recursive or nested SQL call

Status
Not open for further replies.

jfield817

Programmer
Jun 2, 2000
153
US
I have a table Organizations with Orgid and Parentid as fields ... as org and its parent org)

If the Parentid is not null, then Orgid has a parent record
with its own Orgid ...and on up the chain..
If the Parentid is null then that record has no parents.
and is the top org for that group.

How do I retrieve all the records up the chain for
a particular Orgid ...

Some type of nested ..query ?

Thanks
John
 
There are a couple of articles in books-online about this. Index on "Expandind Hierarchies" and "Expanding Networks" do learn how to do this. No recursion is required... Tom Davis
tdavis@sark.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top