标签:led where XML role eid 多行 view 表数据 rom
SELECT Id,UserName,[Password],
STUFF(( SELECT ‘,‘ + [Description]
FROM (SELECT uir.UserId,rol.[Description] FROM [Security].UserInRole uir INNER JOIN [Security].[Role] rol ON rol.Id=uir.RoleId) as userRoleView
WHERE userRoleView.UserId = us.Id
FOR
XML PATH(‘‘)
), 1, 1, ‘‘) AS RoleDescriptions
FROM [Security].[User] us
标签:led where XML role eid 多行 view 表数据 rom
原文地址:http://www.cnblogs.com/taoshengyujiu/p/6018246.html