1 Select Department_id , JOB_ID , SUM(SALARY) TotalSalary, grouping_id(department_id,job_id) lvl
2 from employees
3* group by rollup(department_id,JOB_ID)
SQL> /
DEPARTMENT_ID JOB_ID TOTALSALARY LVL
------------- ---------- ----------- ----------
SA_REP 7000 0
IT_PROG 0
7000 1
10 AD_ASST 4400 0
10 4400 1
20 MK_MAN 13000 0
20 MK_REP 6000 0
20 19000 1
30 PU_MAN 11000 0
30 PU_CLERK 13900 0
30 24900 1
40 HR_REP 6500 0
40 6500 1
50 ST_MAN 36400 0
50 SH_CLERK 64300 0
50 ST_CLERK 55700 0
50 156400 1
60 IT_PROG 28800 0
60 28800 1
70 PR_REP 10000 0
70 10000 1
80 SA_MAN 61000 0
80 SA_REP 243500 0
80 304500 1
90 AD_VP 34000 0
90 AD_PRES 24000 0
90 58000 1
100 FI_MGR 12008 0
100 FI_ACCOUNT 39600 0
100 51608 1
110 AC_MGR 12008 0
110 AC_ACCOUNT 8300 0
110 20308 1
691416 3
34 rows selected.
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.