mamachika
04-19-2006, 10:32 AM
Hello,
I have a table which represents a tree structure. The table columns are:
ID
parentID
Name
and that data looks like this:
1 0 'first category'
2 0 'second category'
3 1 'sub category 1'
4 1 'sub category 2'
5 2 'another sub category'
6 3 'sub-sub category'
etc.
when I am in a certain category, I need to retrieve the names and IDs of all the levels above the current branch of my tree, for example in order to show a bread crumbs path.
Is there a way to retrieve that data with a single query to the database?
Thank you :)
I have a table which represents a tree structure. The table columns are:
ID
parentID
Name
and that data looks like this:
1 0 'first category'
2 0 'second category'
3 1 'sub category 1'
4 1 'sub category 2'
5 2 'another sub category'
6 3 'sub-sub category'
etc.
when I am in a certain category, I need to retrieve the names and IDs of all the levels above the current branch of my tree, for example in order to show a bread crumbs path.
Is there a way to retrieve that data with a single query to the database?
Thank you :)