ReportingAnalyst
MIS
Hi,
I would like to convert my adjancey set model to a nested set model with a left and right.
I understood this part.
Root Node is always with a a Left = 1, right = 2*(Select Count(*) from Table)
How do the leaf node get the left and right numbers.
I was reading an article of Joe Celko regarding the Nested Sets in SQL and I could not understand how do the employee below Albert(who is top level manager) get their node numbers.
If anyone could kindly explain this to me, then I can try converting my table to a nested set model to prevent recursion.
I am using SQL Server 2000
Thanks.
I would like to convert my adjancey set model to a nested set model with a left and right.
I understood this part.
Root Node is always with a a Left = 1, right = 2*(Select Count(*) from Table)
How do the leaf node get the left and right numbers.
I was reading an article of Joe Celko regarding the Nested Sets in SQL and I could not understand how do the employee below Albert(who is top level manager) get their node numbers.
Code:
Adjanceny Model
--------------------------------------------
Emp Boss
Albert Null
Bert Albert
Chuck Albert
Donna Chuck
Eddie Chuck
Fred Chuck
Nested Set Model
----------------------------------------
Emp Left Right
Albert 1 12
Bert 2 3
Chuck 4 11
Donna 5 6
Eddie 7 8
Fred 9 10
If anyone could kindly explain this to me, then I can try converting my table to a nested set model to prevent recursion.
I am using SQL Server 2000
Thanks.