查询所有子节点
with Select_child(id,parentId,value,level) as( select id,parentid,value,0 as level from ctable where parentid=2 union all select c.id,c.parentid,c.value,sc.level+1 from ctable c inner join Select_child sc on c.parentId=sc.id ) select * from Select_child;
查询所有父节点调换颜色部分
原文:https://www.cnblogs.com/tk55/p/8831217.html