I have a table with these sample records:
CREATE TABLE USERROLES(User ID int,ApplicationID int,Roleid INT)
INSERT INTO USERROLES
VALUES (11, 1, 1), (11, 1, 5), (11, 3, 5);
I want to display below output.
USERID ApplicationID Roles
-----------------------------
11 1 1,5
11 3 5
ApplicationID=1 is duplicates for ROLES 1,5.So it should display in single row. I am using SQL Server 2016