sql server - sql adjacency list children for node -
given context: how copy node's children in adjacent list
in adjacency list, how pick node , children?
for example, see highlighted nodes below.
try cte(about cte):
declare @selectednode int = 103; ;with nodes ( select node , parentnode , groupid , depth tablenodes node = @selectednode union select tn.node , tn.parentnode , tn.groupid , tn.depth tablenode tn inner join nodes n on n.node = tn.parentnode ) select * nodes;
Comments
Post a Comment