Accepted answer

if you want to do this without having to write a function to recursively generate a query for each node of the tree, you should consider moving to a nested set architecture rather than a parent/child architecture. this allows for getting a node an all descendants with one query. read this article on the subject for more information: (make sure to read the whole thing. the good stuff doesn't start until the second page.)

Related Articles