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 |
mytestappn
Starting Member
1 Post |
Posted - 2010-10-26 : 03:29:30
|
Hi, I have table in the binary tree format:Userid Parentid004 0006 004008 004010 006 015 006025 008030 008040 010045 010048 015051 015054 025 060 025075 030078 030 004 040084 040Now, my issue is how to count the number of nodes of the subtree for each node.for example, if i take the node 006,the number of nodes of the subtree under 006 is 8.ie;006 is a Parentid for 2 Userid's:010 and 015.Now,the count is 2.Again, 010 and 015 are Parentid's for 4 Userid's:040,045,048,051.Now the count has been incremented to 6.This process continues..And the same goes for each node of the binary treeIts very urgent..please help meThanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-10-26 : 04:00:24
|
Same question again? Lumbago..? N 56°04'39.26"E 12°55'05.63" |
 |
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2010-10-26 : 12:51:56
|
Did you ever bother to read the article I posted the first time this was posted? Go back and do that now: http://www.simple-talk.com/sql/t-sql-programming/binary-trees-in-sql/--CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|