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 |
|
wgpubs
Yak Posting Veteran
67 Posts |
Posted - 2005-03-04 : 14:36:08
|
| Given the following table:CategoryID INTParentCategoryID INTCategoryName Varchar(20)What is the most efficient way to traverse the hierarchy, both up and down, given a specific CategoryID?For example, if I have the following- Clothes - Pants - Long Pants - Short Pants - Really Short Pants - Shirts... and I started with the Pants node then I'd want to returnPants, Long Pants, Short Pants and Really Short Pants as DESCENDANTS. If I started with Short Pants and wanted to get ANCESTORS ... I want returned Short Pants, Pants, Clothes.Thanks - wg |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
|
|
|
|
|