i am looking for the most efficient way to traverse up a tree hierarchy..
i have / will have a table and anticipate millions of records, the tree will not change..
at the moment i am storing a tree string like so
/20/1/1/1/1/1
where 20 is the seed ID..
how to efficiently crawl upwards? I currently have this
select * from reg where tree in ('/20/1/1/1/1','/20/1/1/1','/20/1/1','/20/1','20')
is there an sql command that doesnt require me to split and loop it?
I am using sql server and am aware of the CTE command but does not perform well when there are millions of records.. :/
thanks
Reverse your comparison!
Good luck