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
时间: 2024-10-29 19:10:12