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.

enter image description here

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

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -