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

Posted 秦先生的客栈

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle按照指定列分组合计group by rollup()相关的知识,希望对你有一定的参考价值。

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()的主要内容,如果未能解决你的问题,请参考以下文章