(select stuff((select ',' +cast(PathId as varchar) from RoleInPath where RoleId=o.RoleId for xml path('')),1,1,'')+','+ (select stuff((select ',' +cast(PathId as varchar) from UserInPath where UserId=o.ID for xml path('')),1,1,'')))