标签:
递归上下级部门,获取相关的部门单位
with Temp1 as ( select GroupID,G_ParentID from sys_Group where GroupID={当前部门GroupID} union all select sys_Group.GroupID,sys_Group.G_ParentID from Temp1 inner join sys_Group on Temp1.G_ParentID=sys_Group.GroupID ), Temp2 as ( select GroupID,G_ParentID from sys_Group where GroupID={当前部门GroupID} union all select sys_Group.GroupID,sys_Group.G_ParentID from Temp2 inner join sys_Group on Temp2.GroupID=sys_Group.G_ParentID ) select GroupID from Temp1 union select GroupID from Temp2
标签:
原文地址:http://www.cnblogs.com/ybyi/p/4530200.html