所谓的潇洒

导航

MSSQL的递归查询

通过递归查询部门id为11的部门及其子孙部门

with dep as (
select * from department where dptid=11
union all
select d.* from Department d inner join dep p on d.DptParentID=p.DptID
) select * from dep

posted on 2022-02-09 15:13  所谓的潇洒  阅读(182)  评论(0编辑  收藏  举报