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 |
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2006-09-13 : 11:54:24
|
| For simplicity let's say I have a two table each have two columns(ParentCategory,CurrentCat)null,Shoesshoes,SneakersSneakers,NikeSneakers,Reboketc.(CurrentCat,Product)Nike,JordansRebok,Shaqshow could I query Sneakers and return(Results)JordansShaqsand also how could Query 'nike'and get the catagoryShoes,Sneakers,NikePlease keep in mind this can go on far more then just the 3 levels, I stopped at the three to keep it simple. I'm thinking along the lines of a while exists and appending the string, but is this the best method?Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-09-13 : 12:01:06
|
| Are you v2005?If so look at CTEs in bol - it has a bit on hierarchies.If not do a search - there's stuff on this site andhttp://www.nigelrivett.net/SQLTsql/RetrieveTreeHierarchy.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|