redfull

sql 递归函数使用 

SQL with as

 

示例:      

select * into #temp from Com_Structure a inner join Com_StructureType c on a.Com_SructureTypeID=c.Com_StructureTypeID where c.Type=1;
with cte as
(
select Com_StructureId from #temp where Com_StructureID=@Com_StructureId
union all
select a.Com_StructureId from #temp as a,cte as b where a.ParentStructureID=b.Com_StructureID
)
select * from cte

分类:

技术点:

相关文章:

  • 2021-08-09
  • 2022-12-23
  • 2021-10-08
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
  • 2021-11-28
  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
相关资源
相似解决方案