标签:
WITH TEMP ([ID], [PARENTID]) AS (SELECT UNIQUEID ,PID FROM [DBO].TB_DEPTINFO D WHERE PID = @ParentId UNION ALL SELECT UNIQUEID ,PID FROM [DBO].TB_DEPTINFO I INNER JOIN TEMP ON I.PID = TEMP.[ID]) SELECT * FROM TEMP
标签:
原文地址:http://www.cnblogs.com/sunxuchu/p/5909340.html