select ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird,
sum(case when ta.imonth=1 then ta.itotalapply else 0 end) as 一月, sum(case when ta.imonth=2 then ta.itotalapply else 0 end) as 二月,
sum(case when ta.imonth=3 then ta.itotalapply else 0 end) as 三月, sum(case when ta.imonth=4 then ta.itotalapply else 0 end) as 四月,
sum(case when ta.imonth=5 then ta.itotalapply else 0 end) as 五月, sum(case when ta.imonth=6 then ta.itotalapply else 0 end) as 六月,
sum(case when ta.imonth=7 then ta.itotalapply else 0 end) as 七月, sum(case when ta.imonth=8 then ta.itotalapply else 0 end) as 八月,
sum(case when ta.imonth=9 then ta.itotalapply else 0 end) as 九月, sum(case when ta.imonth=10 then ta.itotalapply else 0 end) as 十月,
sum(case when ta.imonth=11 then ta.itotalapply else 0 end) as 十一月, sum(case when ta.imonth=12 then ta.itotalapply else 0 end) as 十二月,
sum(ta.itotalapply) as 合计 from T_APPLY_RGCB ta
where ta.iyear='2015'
and ta.cdepcode in (select cdepcode from v_department where cdeptype='预算主体' connect by prior cdepcode=cdepclasscode start with cdepcode in('BU01','BU04'))
and ta.cfeeitemcode in(
select cfeeitemcode from v_feeitems where blast='Y'
connect by prior cfeeitemcode=cupfeeitemcode start with cfeeitemcode in(
select cfeeitemcode from t_fee_config where cfeetypecode='FT001'))
group by ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird
order by ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird
------解决思路----------------------
看看是不是有全角的逗号分号什么的,还有小括号,
目测不出来,语法上没有问题。