--cte 的递归
with tds (modeid,modename,parentid)
as
(
select
modeid,modename,parentid
from tb
where parentid=102
union all
select t.modeid,t.modename,t.parentid
from tb t
INNER JOIN tds ts
on t.parentid=ts.modeid
)
select * from tds
go
07-19
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-26
07-26