惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
Forbes - Security
Forbes - Security
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
V
Visual Studio Blog
月光博客
月光博客
博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
The Register - Security
The Register - Security
S
SegmentFault 最新的问题
博客园 - 司徒正美
P
Proofpoint News Feed
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
Cyberwarzone
Cyberwarzone
Simon Willison's Weblog
Simon Willison's Weblog
U
Unit 42
P
Proofpoint News Feed
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
T
Tenable Blog
Hugging Face - Blog
Hugging Face - Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
V
V2EX
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tailwind CSS Blog
V
Vulnerabilities – Threatpost
Latest news
Latest news
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
Intezer
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
博客园 - 【当耐特】
B
Blog RSS Feed
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
NISL@THU
NISL@THU
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security

博客园 - Oracle

JS key大全 JS事件 ORACLE中搜索任意字符串 Oracle's Query Transformer Oracle的几个优化模式 Linux中sar命令 Oracle 复制 DUMP块的分析 enqueue_stats.sql enqueue_locks.sql latch_sleeps.sql latch_spin.sql latch_get.sql latch_types.sql trace_waits.sql session_waits.sql resource_waits.sql routine_waits.sql hidden_parameters.sql - Oracle all_parameters.sql
oracle 中grouping函数的应用
Oracle · 2009-03-13 · via 博客园 - Oracle

select * from test

1 00 001 大 5 15
2 00 001 中 25 75
3 00 001 小 85 25
4 00 002 大 65 35
5 00 002 中 95 85
6 00 002 小 85 25
7 01 001 大 16 14
8 01 001 中 290 75
9 01 001 小 83 22


SELECT num
      ,flg
      ,(CASE WHEN GROUPING(num)=1 THEN 'TOTAL'
             WHEN GROUPING(type)=1 THEN 'SUBTOTAL'
             ELSE type
        END)
      ,sum(number1)
      ,sum(number2)
  FROM test
GROUP BY ROLLUP(num,flg,type)
ORDER BY num NULLS LAST,flg,DECODE(type,'大',1,'中',2,'小',3,4);

1 00 001 大 5 15
2 00 001 中 25 75
3 00 001 小 85 25
4 00 001 SUBTOTAL 115 115
5 00 002 大 65 35
6 00 002 中 95 85
7 00 002 小 85 25
8 00 002 SUBTOTAL 245 145
9 00  SUBTOTAL 360 260
10 01 001 大 16 14
11 01 001 中 290 75
12 01 001 小 83 22
13 01 001 SUBTOTAL 389 111
14 01  SUBTOTAL 389 111
15   TOTAL 749 371