select EXTENSION,
sum(case when month(STARTDATE)=1 then AUTHCHARGE else 0 end) as [Jan],
sum(case when month(STARTDATE)=2 then AUTHCHARGE else 0 end) as [Feb],
sum(case when month(STARTDATE)=3 then AUTHCHARGE else 0 end) as [Mar],
sum(case when month(STARTDATE)=4 then AUTHCHARGE else 0 end) as [Apr],
sum(case when month(STARTDATE)=5 then AUTHCHARGE else 0 end) as [May],
sum(case when month(STARTDATE)=6 then AUTHCHARGE else 0 end) as [Jun],
sum(case when month(STARTDATE)=7 then AUTHCHARGE else 0 end) as [Jul],
sum(case when month(STARTDATE)=8 then AUTHCHARGE else 0 end) as [Aug],
sum(case when month(STARTDATE)=9 then AUTHCHARGE else 0 end) as [Sep],
sum(case when month(STARTDATE)=10 then AUTHCHARGE else 0 end) as [Oct],
sum(AUTHCHARGE) as Total
from CopyCALLDATA
where year(STARTDATE)=2554
group by EXTENSION
order by EXTENSION
ปรากฎว่ามันขึ้น ERROR ว่า "Syntax error (missing operator) in query expression 'sum(case when month(STARTDATE)=1 then AUTHCHARGE else 0 end)' "