标签:查询 use sys 表结构 bsp where rom 级别 分享
------ 算出本部门和子部门的部门ID
WITH TEMP AS (
SELECT b.DeptID
FROM TIni_UserBasicInfo b left join TSys_Department d on d.DeptID=b.DeptID
WHERE UserID=‘User20161021000001‘
UNION ALL
SELECT D1.DeptID
FROM TSys_Department D1
INNER JOIN TEMP D2 ON D1.PDeptID=D2.DeptID
)
select * from TEMP
表结构如下:
标签:查询 use sys 表结构 bsp where rom 级别 分享
原文地址:http://www.cnblogs.com/cxxiao/p/6837298.html