var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: joe celko nested set model: how to compute the lft and rgt cols
With reference to http://www.intelligententerprise.com...questid=235427
I want the "sql stmt" which wud give the lft and rgt col values..
i am reading his book but cant understand where he explains
wat lft and rgt cols are..
"The root is always (lft,rgt) (1, 2*(Select count(*)from table) and leaft nodes are (lft+1=rgt)"
My suggestion would be to go through the book again.
Originally Posted by dbaguru
Look at the NestTree
node lft rgt
'A' 1 12
'B' 2 3
'C' 4 11
'D' 5 6
'E' 7 8
'F' 9 10
It says : the root is always (lft,rgt)=(1,2 * (SELECT COUNT(*) FROM TreeTable)) and leaf nodes always have (lft+1)=rgt)
Select node AS root
i.e root is according to the above 'A' 1 ,12
and leaf node is
SELECT node AS leaf
i.e 'B' 2,3
I hope u got it now...
Success is the ability to go from one failure to another with no loss of enthusiasm.
- Sir Winston Churchill
i understood the relationship between lft and rght cols..
but how on earth do we get the values for those cols in the 1st place...
dont bother i figured it out...