DECLARE @OrgId nvarchar(36)SET @OrgId = N'901205CA-6C22-4EE7-AE4B-96CC7165D07F';WITH Childs AS( SELECT * FROM HROrgRelation WHERE ParentNM = @OrgId UNION ALLSELECT A.* FROM HROrgRelation A, Childs B WHERE A.FatherID = B.ParentNM) SELECT ParentNM FROM Childs