• DBA12345 (4/29/2013)


    I need add multiple rows and take sum of that row in to single column

    Server|||| Cost

    abcd ||||| 75

    abcd ||||| 25

    dtgr ||||| 65

    dtgr ||||| 35

    table should lok like below.

    Server||||| Cost

    abcd ||||| 100

    abcd ||||| 100

    dtgr ||||| 100

    dtgr ||||| 100

    or

    abcd |||||100

    dtgr |||||100

    select

    Server,

    sum(Cost) as TotalCost

    from

    dbo.MyTable

    group by

    Server

    order by

    Server;