OT: Parent-Child Relationships within Table

2005-05-09 Thread Kazmierczak, Kevin
How does everyone handle an N level parent-child type relationship within the same table? Say you have the following table setup for Categories categoryid category parentid You could have any level of categories each with the parent pointing up the path. The problem I'm interested

Re: OT: Parent-Child Relationships within Table

2005-05-09 Thread Sergey Croitor
Additional parent_path field will help you to retrieve all the branch starting at a given tree item by a single SELECT query: SELECT * FROM Categories WHERE parent_path LIKE '#start_item_path##path_delimiter#%' If you want to avoid having problems with keeping parent_path field in actual state

Re: OT: Parent-Child Relationships within Table

2005-05-09 Thread Jochem van Dieten
Sergey Croitor wrote: Additional parent_path field will help you to retrieve all the branch starting at a given tree item by a single SELECT query: SELECT * FROM Categories WHERE parent_path LIKE '#start_item_path##path_delimiter#%' If you want to efficiently query subsets of the entire

Re: OT: Parent-Child Relationships within Table

2005-05-09 Thread Al Everett
Academic, really, with Oracle 9i. (Which is what we're using at the day job.) If 7 is the categoryid for Hockey: select categoryid, category, level from catalog start with categoryid=7 connect by parentid = prior categoryid level is a pseudo-column indicates the level of the tree, starting with