首页 > 数据库技术 > 详细

建工发债sql

时间:2015-10-25 16:09:06      阅读:376      评论:0      收藏:0      [点我收藏+]

管理费用

为了得到科目名称,只好再从外面写一层

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
 

 

建工发债sql

原文:http://www.cnblogs.com/sumsen/p/4908768.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!