玩龙天子 发表于 2016-10-31 04:48:56

SQL SERVER WTIH AS

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
页: [1]
查看完整版本: SQL SERVER WTIH AS