I want to wrap the column which have two different messages for same queueID and it should not be hard-coded on messages column.
This is my table :
CREATE TABLE [dbo].[test]
(
[id] [int] IDENTITY(1,1) NOT NULL,
[queueID] [int] NULL,
[messages] [nvarchar](50) NULL,
[firstname] [nvarchar](20) NULL,
[secondname] [nvarchar](20) NULL
)
Table Input are :
insert into test
values (1,'Connection failed','j','s')
, (1,'Connection failed','j','s')
, (1,'Connection failed','j','s')
, (2,'Connection failed','j','s')
, (2,'Error message','j','s')
, (2,'Connection failed','j','s')
, (3,'Connection failed','j','s')
, (3,'Connection failed','j','s')
, (4,'Connection failed','j','s')
, (4,'Error message','j','s')
, (4,'third party','j','s')
, (5,'Error message','j','s')
, (5,'third party','j','s')
In Above table my expected result is
queueID messages
------------------------------------------------
1 Connection failed
2 Connection failed,Error message
3 Connection failed
4 Connection failed,Error message,third party
5 Error message,third party