with a as (
select id,name,parentid from categories where id=53
union all
select x.id,x.name,x.parentid from categories x,a where x.parentid=a.id
)
select * from a
with a as (
select id,name,parentid from categories where id=53
union all
select x.id,x.name,x.parentid from categories x,a where x.parentid=a.id
)
select * from a
转载于:https://www.cnblogs.com/chenxizhaolu/p/9273648.html