[thelist] How do I SELECT for the following...

r937 rudy at r937.com
Thu Feb 4 09:11:31 CST 2010


> Searchtags can be arranged in an arbitrarily deep tree.
> ...
> I want to select all of the searchtags in ONE branch of the tree

those two facts together pretty much put the kibosh on doing this with a 
simple query

searching through an entire branch, with an unknown number of levels, is 
next to impossible using the adjacency data model (which is characterized by 
the use of a "parentid" column)

if you were to switch to the nested set model (characterized by the use of 
"lft" and "rgt" columns), things will go a lot easier for you, although i 
can't help you with it as i don't do the nested set model

rudy
http://simply-sql.com/ 




More information about the thelist mailing list