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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CELKO'S NESTED TREE SET

Status
Not open for further replies.

Deleted

Technical User
Jul 17, 2003
470
US
Just made the move from using the adjacency list model (id, parent) to using the nested set model (id, lft, rgt).

Currently running MySQL 4.17

My goal is to create a virtual directory.

The question I have is:

Is it possible to limit the results of a SELECT to only return the next level in the tree (without the children).

 
Are you sure this will work? A typical directory is not a binary tree, which is what you've got.

 
nested set model is not necessarily a binary tree

unixjunky, if all you wanted was the next level, the adjacency model is perfect for that, it's a simple self-join

otherwise, you're on your own, i know celko has published a book on his nested set model and you may need to buy it to feel comfortable with writing the sql

i know every time i've tried to understand it, i ended up spending far too much time drawing pictures and never did get as far as the sql...

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (course starts January 9 2005)
 
i know celko has published a book on his nested set model"

I got both of his books. Unfortunately almost everything relies on stored procedures which is not available on the version on MySQL I am running.

Regardless the adjacency list and nested tree set both have their limitations. It would be nice to strike a balance between the two.

Thanks,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top