SQL Server公用表达式CET递归查询所有上级数据

with cte as(
select bianma,fjbm from #tree where chkDisabled='true'
union all 
select t.bianma,t.fjbm from cte c inner join #tree t on c.fjbm=t.bianma
)
select * from cte;

 

posted @ 2017-10-19 18:06  成宇佳  阅读(962)  评论(0编辑  收藏  举报