HI I am using the below query and getting the result.
select name,
Totalfor2006=isnull([2006],0),
Totalfor2005=isnull([2005],0)
from #temp
pivot
(
Sum(amt)
for [yr] in ([2006],[2005])
) as P
Name Totalfor2006 Totalfor2005
---------------------------------
x 100 200
Y 10 20
Now I need Column Total as below with the above query.
can anybody help me out in this.
Name Totalfor2005 Totalfor2005 <b>Total</b>
------------------------------------------
x 100 200 300
Y 10 20 30
select name,
Totalfor2006=isnull([2006],0),
Totalfor2005=isnull([2005],0)
from #temp
pivot
(
Sum(amt)
for [yr] in ([2006],[2005])
) as P
Name Totalfor2006 Totalfor2005
---------------------------------
x 100 200
Y 10 20
Now I need Column Total as below with the above query.
can anybody help me out in this.
Name Totalfor2005 Totalfor2005 <b>Total</b>
------------------------------------------
x 100 200 300
Y 10 20 30