shiningrise

sql 树 递归

with SubQuery(No,Name,ParentNo) as (  
  select No,[Name],ParentNo from [Port_Dept] where No = \'3\' 
  union all  
  select A.No,A.Name,A.ParentNo   
  from [Port_Dept] A inner join SubQuery B  
    on A.No = B.ParentNo  
)  
select * from SubQuery  

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-12-23
  • 2021-07-21
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案