--获得上级
with my
as
(
select * from TB_Area
where AreaID
=72344566572777472
union all
select aa.
* from my,TB_Area aa
where my.ParentID
=aa.AreaID
) select * from my
go
--获得下级
with my
as
(
select * from TB_Area
where AreaID
=72339069014638592
union all
select aa.
* from my,TB_Area aa
where my.AreaID
=aa.ParentID
) select * from my
转载于:https://www.cnblogs.com/daixingqing/archive/2012/11/13/2768275.html
转载请注明原文地址: https://mac.8miu.com/read-26926.html