zoukankan      html  css  js  c++  java
  • oracle 统计结合横向和纵向统计得结果

    select nvl(t.NAME, '合计') NAME,
           sum(decode(t.vehicletypename, 'A1', j.totalhours, 0.00)) as A1,
           sum(decode(t.vehicletypename, 'B2', j.totalhours, 0.00)) as B2,
           sum(decode(t.vehicletypename, 'C1', j.totalhours, 0.00)) as C1,
           sum(decode(t.vehicletypename, 'C2', j.totalhours, 0.00)) as C2,
           sum(decode(t.vehicletypename, 'C3', j.totalhours, 0.00)) as C3,
           sum(decode(t.vehicletypename, 'C4', j.totalhours, 0.00)) as C4,
           sum(decode(t.vehicletypename, 'A3', j.totalhours, 0.00)) as A3,
           sum(decode(t.vehicletypename, 'B1', j.totalhours, 0.00)) as B1,
           sum(decode(t.vehicletypename, 'A2', j.totalhours, 0.00)) as A2,
           sum(j.totalhours) as "合计"
      from personinfo_view t, person_all_hours j
     where t.ID = j.personid
     group by rollup(t.NAME)
  • 相关阅读:

    队列
    数据结构简介
    标准模板库
    类模板
    函数模板
    srvctl error
    FLASH BACK
    RAC 设置archive log模式
    CHAPTER 1 Architectural Overview of Oracle Database 11g
  • 原文地址:https://www.cnblogs.com/xgxhellboy/p/3135128.html
Copyright © 2011-2022 走看看