oracle中使用cube子句

来源:互联网 发布:软件动态分析工具 编辑:程序博客网 时间:2024/06/04 17:43

cude()函数是在需要对分组的数据进行统计的时候使用,

select job_id , division_id ,sum(salary) from employee group by cube(job_id,division_id);

结果如下:

job     div     sum(salary)

eng    ope    10

eng              10

mgr    bus    20

mgr    ope    10

mgr    sal     10

mgr    sup    10

mgr              50 

           bus    20

           ope    20

           sal    10

           sup   10

 注意最后ope的统计。

0 0
原创粉丝点击