• 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