April 29, 2013 at 3:53 pm
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
April 29, 2013 at 4:00 pm
DBA12345 (4/29/2013)
I need add multiple rows and take sum of that row in to single columnServer|||| 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;
April 29, 2013 at 4:23 pm
Thanks alot..its working
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply