数据表查询所有子/父节点

查询所有子节点

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;

 查询所有父节点调换颜色部分

相关文章:

  • 2021-07-02
  • 2021-12-19
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案