Home Forums SQL Server 2008 SQL Server Newbies Concatenate column rows into one row with a group by RE: Concatenate column rows into one row with a group by
skpanuganti
Mr or Mrs. 500
Points: 596
More actions
March 7, 2010 at 9:46 am
#1129770
select grp,sum([amount]) [amount],case when [grp]=1 then 'A01,A02,A03'
when [grp]=2 then 'A22'
else 'A33,A36' end [ledger]
from dbo.sqlcentral
group by grp
-- replace 'dbo.sqlcentral' with your table name
Thanks,
Santosh