I am using SQL Server 2005 and would like to find an easier way to concat multiple rows into 1 string.
PK Column1, Column2
-- ------- -------
PK1 apple orange
PK1 pear banana
PK1 honey
PK2 apple2 orange2
PK2 pear2 banana2
PK2 honey2
Results :
PK1, apple orange pear banana honey
PK2, apple2 orange2 pear2 banana2 honey2
It is very easy to use COALESCE but it is not available in SQL Server 2005. I tried XML Path but it appends additional character to the end.
Could you please provide me some suggestion ? Thanks.