with result
as
(
select id, parentid,name from syst_dept where id = 'b649a10a3fa8017b003165fea703fa81'
union all
select a.id,a.parentid,a.name from syst_dept a join result b on
-- b.parentid = a.id -- 向上查询
a.parentid = b.id --向下查询
)
select * from result
SQL SERVER WTIH AS
最新推荐文章于 2023-07-26 15:23:32 发布