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 |
|
nmg196
Yak Posting Veteran
70 Posts |
Posted - 2001-02-15 : 19:40:38
|
| Hi,I've got a problem that's been really annoying me for a while now. My SQL is just good enough for me to do what I need to do...Basically, my website has a tree structure of categories which has the tree 'drawn' on the left hand side of the page. When a user clicks on a category, it expands revealing it's subcategories. I only want to show one folder open at once, but I do need to be able to go down to about 3 levels. So in the diagram below, the Programming folder has been expanded and the emboldend items will have open folder icons:PeripheralsSoftware___Accounting___Games___Programming______Compilers______IDEs______Debuggers___Operating Systems___Word ProcessorsComputersServicesThe question is is there a way I call call a stored procedure that will a return all the information I need to draw the above structure?I'm guessing that I'll need to know the id, parent id and level of each item in the list.I'm storing the information in a table as below (where a parentID of 0 signifies a root node):ParentID ID strName0 1 Peripherals0 2 Software0 3 Computers0 4 Services2 5 Accounting2 6 Games2 7 Programming2 8 Operating Systems2 9 Word Processors7 10 Compilers7 11 IDEs7 12 Debuggers... etcThis should be really easy, but I can't work out how to get all the information back in one query.Thanks!Nick...Edited by - nmg196 on 02/15/2001 19:44:31 |
|
|
|
|
|