LiXiang98

导航

 
with cte as
        (
            select  *, 0 as level from Organization where  ParentID=''
            union all
            select d.*,level + 1 from cte c 
            inner join Organization  d    on c.ID = d.ParentID
        )
        select a.* from cte a

 

posted on 2023-11-13 11:24  LiXiang98  阅读(34)  评论(0)    收藏  举报