Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-08 : 08:40:57
Matt writes "I have a table that includes data as parents and childrens, it looks like this:

ID  PARENTID  NAME
-------------------
1 0 NAME-A
2 1 NAME-B
3 2 NAME-C
4 3 NAME-D
5 4 NAME-E


I want to select all the parent of a given id (i.e. if id = 5, I want to return NAME-A/NAME-B/NAME-C/NAME-D/NAME-E)
Is it possible to do this in sql only???

Thanks
Matt"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-08 : 08:46:21
See if this article helps:

http://www.sqlteam.com/item.asp?ItemID=8866

Go to Top of Page
   

- Advertisement -