with cte as
(
select 1 as lvl, SpaceShuttleID , ParentSpaceShuttleID from SpaceShuttle where SpaceShuttleID = 200
union all
select
cte.lvl + 1, b.SpaceShuttleID , b.ParentSpaceShuttleID from
SpaceShuttle b join cte on cte.SpaceShuttleID = b.ParentSpaceShuttleID
)
select * from cte order by lvl;
No comments:
Post a Comment