stu2024-06-20
我有一个存储过程,它返回这样的结果,对于一个记录,如果我有两个角色,我得到两个单独的行。我想只有这样一行:
UserId FirstName LastName Role
34 Rahul Gupta Manager
34 Rahul Gupta Director
存储过程是:
UserId FirstName LastName Role
34 Rahul Gupta Manager,Director
这不起作用..我在这里做错了
SELECT [USER].[USER_ID] AS [UserId]
,[FIRST_NM] AS FirstName
,[LST_NM] AS LastName
,[Role].[ROLE_ID] AS RoleId
,[Role].[ROLE_NM] AS Role
FROM [dbo].[USER] [User] (NOLOCK)
INNER JOIN dbo.USER_ROLE [USER_ROLE] on [User].USER_ID=[USER_ROLE].USER_ID
INNER JOIN dbo.ROLE [Role] on [Role].ROLE_ID=[USER_ROLE].ROLE_ID
WHERE [USER].[SSO_ID] = 'xyz'