参考博客 https://www.cnblogs.com/tangchun/p/10307734.html
Menu表
with temp(Id,Name,Pid)
as(
select Id,Name,Pid from menu where id=1
union all
select m.Id,m.Name,m.Pid from menu m
inner join
temp t on (m.Pid = t.Id)
)
select * from temp;
参考博客 https://www.cnblogs.com/tangchun/p/10307734.html
Menu表
with temp(Id,Name,Pid)
as(
select Id,Name,Pid from menu where id=1
union all
select m.Id,m.Name,m.Pid from menu m
inner join
temp t on (m.Pid = t.Id)
)
select * from temp;