Oracle分组查询2——cube 和rullup一样 只是结果维度更多了!
eg.按工龄、部门、职务 从大到小 查询工资和
select to_char(b.hiredate) as 上班日期,a.dname as 部门,b.job as 职务,sum(b.sal) sum_sal from dept a, emp b
where a.deptno=b.deptno group bycube(to_char(b.hiredate),a.dname,b.job)
Oracle分组查询2——cube 和rullup一样 只是结果维度更多了!
eg.按工龄、部门、职务 从大到小 查询工资和
select to_char(b.hiredate) as 上班日期,a.dname as 部门,b.job as 职务,sum(b.sal) sum_sal from dept a, emp b
where a.deptno=b.deptno group bycube(to_char(b.hiredate),a.dname,b.job)