roll up totals in a hierarchy query
420747May 18 2007 — edited May 21 2007I 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.