Day int Name varchar(50) Amount int
Day A B 1 100 50 2 35 26
select sum(A+B) as OneDay from Days Group by Day
select * from (select [DAY],name, amount from Dummy) upt pivot ( sum(amount) for name in ([A], [B]) ) as p
PIVOT
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)