Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

roll up totals in a hierarchy query

420747May 18 2007 — edited May 21 2007
I would think this is a very simple, built-in thing, but can't figure it out and can't find any help anywhere for it.

I have a standard hierarchy, like the employer/manager relationship in the sample EMP table. Using the standard EMP table as an example, what I'd like to do is "roll up" the salaries and accumulate them into a total at each managerial level.

For instance, the root of the hierarchy would be the PRESIDENT of the company and his "total salary" column would be the summation of his salary and everyone under him. Each manager's "total salary" column would be the summation total of his/her own salary and all salary's below his/hers.

This seems trivial, but it's escaping me for some reason. Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 18 2007
Added on May 18 2007
10 comments
1,324 views