;with Tree as
(
select wjgl_20_col_10 as ID, wjgl_20_col_30 as Name,wjgl_20_col_60 as Parent from wjgl_20
where WJGL_20_COL_50=1 and (WJGL_20_COL_70 is null or WJGL_20_COL_70=1) and WJGL_20_COL_100=1
)
,CTE as
(
-->Begin 一个定位点成员
select ID, Name,Parent,cast(‘已发布文件/‘+Name as nvarchar(max)) as TE,0 as Levle from Tree where Parent=‘0‘
-->End
union all
-->Begin一个递归成员
select Tree.ID, Tree.Name,Tree.Parent,cast(CTE.TE+‘/‘+Tree.name as nvarchar(MAX)) as TE,Levle+1 as Levle
from Tree inner join CTE
on Tree.Parent=CTE.ID
-->End
)
select * from CTE order by TE
时间: 2024-12-29 23:59:27