Page 1 of 1

tree traverse - actually get parent_id

Posted: Thu Apr 26, 2007 11:28 am
by GeXus
I'm trying to do a select statement that will allow me to actually return the parent category_id from a tree traversal. I know that this is not typically how it's done, but I need to know the parent id for this JavaScript I want to use..

Thanks a lot!

Posted: Thu Apr 26, 2007 1:13 pm
by Weirdan
something like this may work:

Code: Select all

select id
from tree
where `left` < $nodeLeft
order by `left` desc
limit 1,1

Posted: Thu Apr 26, 2007 1:15 pm
by GeXus
That simple eh.. i'll give it a try.. thanks!