Hello,
I am trying to do a sum(case statement but not sure if I am going the right way about it
This is what my sql statement looks like I ge a syntax error
in the first sum(case
I am trying to do a sum(case statement but not sure if I am going the right way about it
This is what my sql statement looks like I ge a syntax error
in the first sum(case
Code:
select [Sales Jan 2007 Through Oct 2009].FEKNNB, [Sales Jan 2007 Through Oct 2009].FEAAC3, [Sales Jan 2007 Through Oct 2009].DDAITX,
sum(case [Sales Jan 2007 Through Oct 2009].year when 07 then [Sales Jan 2007 Through Oct 2009].DDDPVA, else 0 end)GRS07,
sum(case [Sales Jan 2007 Through Oct 2009].year when 07 then [Sales Jan 2007 Through Oct 2009].TOTALCOST, else 0 end)COST07,
sum(case [Sales Jan 2007 Through Oct 2009].year when 08 then [Sales Jan 2007 Through Oct 2009].DDDPVA, else 0 end)GRS08
sum(case [Sales Jan 2007 Through Oct 2009].year when 08 then [Sales Jan 2007 Through Oct 2009].TOTALCOST, else 0 end)COST08
sum(case [Sales Jan 2007 Through Oct 2009].year when 09 then [Sales Jan 2007 Through Oct 2009].DDDPVA, else 0 end)GRS09
sum(case [Sales Jan 2007 Through Oct 2009].year when 09 then [Sales Jan 2007 Through Oct 2009].TOTALCOST else 0 end)COST09
from [Sales Jan 2007 Through Oct 2009].year group by [Sales Jan 2007 Through Oct 2009].year.feknnb, [Sales Jan 2007 Through Oct 2009].yearfeaac3