RustyZ32
asked on
SQL Results horizontal
I found this sample online:
DECLARE @id_list VARCHAR(MAX) --varchar max works for SQL 2005 or above
SELECT @id_list = CASE WHEN @id_list IS NULL THEN CONVERT(VARCHAR,column1)
ELSE @id_list + ',' + CONVERT(VARCHAR,column1) END
FROM table1
SELECT @id_list
which works great to display a single column horizontally but I need to display one column normally with the results of another horizontally:
Bob smith | 09/12/2011, 09/13/2011, 09/15/2011
in that example all dates with the name value bob smith.
DECLARE @id_list VARCHAR(MAX) --varchar max works for SQL 2005 or above
SELECT @id_list = CASE WHEN @id_list IS NULL THEN CONVERT(VARCHAR,column1)
ELSE @id_list + ',' + CONVERT(VARCHAR,column1) END
FROM table1
SELECT @id_list
which works great to display a single column horizontally but I need to display one column normally with the results of another horizontally:
Bob smith | 09/12/2011, 09/13/2011, 09/15/2011
in that example all dates with the name value bob smith.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER