码迷,mamicode.com
首页 > 数据库 > 详细

oracle 报表带小计合计

时间:2017-03-15 18:20:57      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:ping   cas   ges   null   src   else   from   img   rom   

select
case when (grouping(glbm)=1) then ‘合计‘ else DECODE(glbm,null,‘‘,glbm) end glbm,
case when (grouping(hpzl)=1) then ‘‘ else DECODE(hpzl,null,‘‘,hpzl) end hpzl,
case when (grouping(syxz)=1 and grouping(hpzl)=0) then ‘小计‘ else DECODE(syxz,null,‘‘,syxz) end as syxz,
count(*)
from VEHICLEBA
where hpzl in (‘01‘,‘02‘,‘15‘) and (ywlx=‘登记‘ or ywlx=‘转出中‘)
group by rollup(glbm,hpzl,syxz)

 

技术分享

oracle 报表带小计合计

标签:ping   cas   ges   null   src   else   from   img   rom   

原文地址:http://www.cnblogs.com/bin521/p/6555494.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!