Sie sind auf Seite 1von 1

select sum(salary), deptid, jobid from emptable group by rollup(deptid, jobid)

order by 2, 3;
10 ad 4000
10 a3 5000
10 9000
9000
select sum(salary), deptid, jobid from emptable group by cube(deptid, jobid) order
by 2, 3;
10 ad 4000
10 a3 5000
10 9000
ad 4000
a3 5000
9000

select sum(salary), deptid, jobid, grouping(deptid), grouping(jobid) from emptable


group by cube(deptid, jobid) order by 2, 3;
10 ad 4000 0 0
10 a3 5000 0 0
10 9000 0 1
ad 4000 1 0
a3 5000 1 0
9000 1 1

Das könnte Ihnen auch gefallen