Hi,
I have the following SQL statement and would like to display the results in 2 columns with ID and all the Category displayed in a single line separated by a comma.
Example:
1234 Admin, Manager, Sales
345 Sales
41234 Manager, Sales
6467 Manager, Sales
91234 Sales
Please use this SQL Statement for the data set:
DECLARE @TBL_EXAMPLE table
(
[ID] varchar(50),
[Category] varchar(25)
)
INSERT INTO @TBL_EXAMPLE ([ID], [Category])
VALUES
('1234', 'Manager'),
('1234', 'Sales'),
('345', 'Sales'),
('6467', 'Manager'),
('6467', 'Sales'),
('41234', 'Sales'),
('41234', 'Manager'),
('91234', 'Sales'),
('1234', 'Admin');
select * from @TBL_EXAMPLE