管理费用
为了得到科目名称,只好再从外面写一层
select a.*, (select b.subjname from bd_accsubj b where b.subjcode=a.scode and b.pk_glorgbook=‘0001E1100000000000MX‘) 项目--从总部机关的会计科目得到名称 from ( select substr(bd_accsubj.subjcode,1,6)scode, sum( case when gl_balance.year= ‘2014‘ then gl_balance.debitamount else 0 end) "2014发生额", sum( case when gl_balance.year= ‘2013‘ then gl_balance.debitamount else 0 end) "2013发生额", sum( case when gl_balance.year= ‘2012‘ then gl_balance.debitamount else 0 end) "2012发生额" from gl_balance, bd_accsubj, bd_glorgbook where gl_balance.pk_accsubj = bd_accsubj.pk_accsubj and bd_glorgbook.pk_glorgbook = gl_balance.pk_glorgbook and bd_glorgbook.glorgbookcode like ‘01%-0001‘ and (bd_accsubj.subjcode like ‘5502%‘ ) and gl_balance.period<>‘00‘ and gl_balance.year in(‘2012‘,‘2013‘,‘2014‘) group by substr(bd_accsubj.subjcode,1,6) order by substr(bd_accsubj.subjcode,1,6))a order by a.scode
时间: 2025-01-08 21:20:45