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

oracle按照指定列分组合计group by rollup()

时间:2018-02-04 00:33:39      阅读:430      评论:0      收藏:0      [点我收藏+]

标签:stat   code   decode   class   组合   group   查询语句   分类   Owner   

group by rollup() 按分组合计

select grouping(status),status,owner,object_type,count(*) from dba_objects

where owner not in (‘SYS‘,‘SYSTEM‘)

group by rollup (status,owner,object_type)

order by status,owner,object_type;

经典分类查询语句:

select object_type,count(*) from

( select decode(object_type,‘TABLE‘,‘TABLE‘,‘INDEX‘,‘INDEX‘,‘OTHERS‘) object_type from dba_objects )

group by rollup(object_type);

oracle按照指定列分组合计group by rollup()

标签:stat   code   decode   class   组合   group   查询语句   分类   Owner   

原文地址:https://www.cnblogs.com/qinjf/p/8410970.html

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