sql 递归查询,查出所有子节点

with t as
(
  select b.* from Base_Department b where ParentId = 'cce4152c-3483-4334-b68d-155da627bca0' 
  union all
  select a.* from Base_Department a join t b on a.ParentId=b.DepartmentId
)
select * from t

  

posted @ 2018-04-03 18:53  你也很优秀  阅读(10902)  评论(1编辑  收藏  举报