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.
| Author |
Topic |
|
yan_er04
Starting Member
1 Post |
Posted - 2005-11-21 : 03:21:59
|
| Not sure whether this is possible in a single SQL. I'm using MS SQL 2000. i have a tbl with a subFolderID (unique ID) and a parentID, the parentID basically refer to the same table (tells me the parent folder of that specific folder) i want to retrieve the directory structure now... of a specific subFolderID... how do i do it? the logic is something like using the subFolderID, find the parentID, using that as a subFolderID, find the parentID and so on... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
surendrakalekar
Posting Yak Master
120 Posts |
Posted - 2005-11-21 : 04:07:45
|
| Using self join it is possible ... try this.SELECT YT1.subFolderID, YT2.parentID, field1,field2....FROM YourTable YT1 INNER JOIN YourTable YT2 ON YT1.subFolderID = YT2.parentIDWHERE (your conditions)ORDER BY (sorting fields)HTHSurendra |
 |
|
|
|
|
|