用标准sql的with实现递归查询

with subqry(id,name,pid) as (
  select id,name,pid from test1 where id = 5 --指定id
  union all
  select test1.id,test1.name,test1.pid from test1,subqry where test1.pid = subqry.id
)
select* from subqry;

相关文章:

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