I have left-right trees in my database which are a problem for performance. I'll switch to a system with a parentId and an orderId.
I'm looking for a sql script that can give me the index of a node in a left-right tree.
Like this?
select COUNT(treestructureid)
from TreeStructures s,
(select leftvalue, rightvalue, treeid, ParentTreeStructureId from TreeStructures where TreeStructures.TreeStructureId = 204260)
as data
where s.LeftValue <= data.LeftValue and s.RightValue <= data.RightValue
and s.TreeId = data.TreeId and s.ParentTreeStructureId = data.ParentTreeStructureId