| Author |
Topic |
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2004-03-24 : 21:57:00
|
| Hi,My table:Table Blah( blahID INT, ParentBlahID INT, Name VARCHAR(50))Can someone help me with a recursive function that I can do at the Sql Server level that can give me a breadcrumbs string back?e.g hello/world/thanksIs this possible? If so, is it really bad in terms of performance? (maximum realistic levels are going to be mabye 5-7).Thanks! |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
|
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2004-03-27 : 23:01:30
|
| how to you get the parent node of any given node? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-03-28 : 12:19:35
|
| In the article, the parent node is stored with the node, and the lineage/breadcrumbs are built from these values. |
 |
|
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2004-03-30 : 06:26:51
|
| Sorry what I meant was the TopLevel Parent of any given node.I guess I have to do some string hacks to parse the breadcrumbs to get the node?Example: '/100/101/102/'I have to get the index of the 1st and 2nd '/' and then grab the 100 and that's teh ID of the TOp Level parent?And if there is only a '/' we are at the toplevel...correct? |
 |
|
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2004-03-30 : 06:28:53
|
| Question#2Is there a query that can update the # of content items linked to each category? Category#1 (25) SubCategory#2 (10) SubCategory#3 (15) SubSubCategory#3.1 (10) SubSubCategory#3.2 (5)Is that possible? Realy stumped on this! |
 |
|
|
sql777
Constraint Violating Yak Guru
314 Posts |
Posted - 2004-06-18 : 07:25:23
|
| anyone? Still haven't found the solution to find the # of subcategories under a category. I want a batch query to do this, not on the fly. |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
|
|
sql777
Constraint Violating Yak Guru
314 Posts |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-06-18 : 09:07:42
|
| Maybe something like this??Select Node,Cnt = (Select sum((Select count(*) From contents where Node = Z.Node)) From Tree as Z Where Z.lineage like A.lineage + A.Node + '/') From Tree as ACorey |
 |
|
|
|