syed afroz

syed afroz

  • NA
  • 54
  • 0

how to count number of left and right nodes of a root node in sql sever 2000

Jul 18 2010 8:02 AM
Hi!
I'm using sql server 2000, I need to count number of nodes in left and right side of a root node....
suppose i've entries in table as

node   parent_node  Position  node_name
1           0                      'L'            abc
2           1                       'L'            b1
3           1                       'R'             b2
4           2                       'L'             c1
5           2                       'R'             c2
6           3                       'L'              d1

if i supplied node '1' then it should Give result as
left count=3      and
right count =2

Plz help me out.... Thanx in advance..


Answers (7)