加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle同环比计算

发布时间:2020-12-12 13:12:39 所属栏目:百科 来源:网络整理
导读:with temp as (select to_char(jsrq,‘yyyymm‘) as month,sum(zfy ) as num from hip_mz_ys a,JCXX_JG b,jcxx_ks c,jcxx_ry d where a.jg_id = b.yljgdm and a.bm_id = c.ksid and a.ry_id = d.ylryid group by to_char(jsrq,‘yyyymm‘)) select month,rou

with temp as (select to_char(jsrq,‘yyyymm‘) as month,sum(zfy ) as num from hip_mz_ys a,JCXX_JG b,jcxx_ks c,jcxx_ry d where a.jg_id = b.yljgdm and a.bm_id = c.ksid and a.ry_id = d.ylryid group by to_char(jsrq,‘yyyymm‘)) select month,round(nvl(num * 100 / (select num from temp t1 where t1.month = (substr(t.month,1,4) - 1) || substr(t.month,-2)),0),2) as 同比,round(nvl(num * 100 / (select num from temp t2 where t2.month = to_char(to_date(t.month,‘yyyymm‘) - 1,‘yyyymm‘)),2) as 环比 from temp t order by month asc

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读