Subject | Select question |
---|---|
Author | Sandor Szollosi |
Post date | 2003-03-24T16:31:46Z |
Hi all
There are a Table1 containing nodes of a tree.
Fields: ID,Name,ParentNodeID,RootNodeID
User can add more childnode to any existing node.
This will cause new records appending into Table1. And results a
difficult tree in a simple table.
But if I have an ID, how would I select ParentNodeID of it,
and if exists ParentNodeID its parent,
and if exists ParentNodeID of parent's parent, etc.
I'd like to get all IDs up to RootNode in this line.
Have you any idea to make one select to do it?
TIA
Sandor
There are a Table1 containing nodes of a tree.
Fields: ID,Name,ParentNodeID,RootNodeID
User can add more childnode to any existing node.
This will cause new records appending into Table1. And results a
difficult tree in a simple table.
But if I have an ID, how would I select ParentNodeID of it,
and if exists ParentNodeID its parent,
and if exists ParentNodeID of parent's parent, etc.
I'd like to get all IDs up to RootNode in this line.
Have you any idea to make one select to do it?
TIA
Sandor