Possible Duplicate:
How to store directory / hierarchy / tree structure in the database?
I use this query:
SELECT Id, Name, ParentId
FROM Table_1
And then I build the tree using all elements.
But what if I want to build a tree that starts from definite Id
, so I need to make a query that returns only this Id
and all childs of this Id
Like this:
SELECT Id, Name, ParentId
FROM Table_1
WHERE (Id = randomNumber) OR (all possible childs of Id = randomNumber)
Help me please to make a query.
EDIT:
This is how you can make it in Oracle
SELECT Id, Name, ParentId
FROM table_1
Connect by prior Id = ParentId
Start with Id = randomNumber
I need MS-Access