skpanuganti (3/7/2010)
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
That certainly works for the data given but I suspect that there might be just be a few more ledger entries than what was posted. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.