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;
原文地址:https://www.cnblogs.com/chengyujia/p/7693955.html