Skip to Main Content

SQL & PL/SQL

Pivot with multiple aggregate function calls?

TexasApexDeveloperDec 8 2014 — edited Dec 9 2014

Hi,

  Using Oracle 11g R2, with APEX 4.2.3, I am trying to take the following cross tab (pivot) built query:

begin
return 'with pivot_data as (
                                                SELECT department_id, job_id, salary
                                                FROM oehr_employees
                                              )
SELECT *
FROM pivot_data
PIVOT (
SUM(salary)
FOR department_id
IN ('||v('P5_DEPT_LIST')||')
)';
end;

Which works just fine, and add in the comm column and also have the pivot sum and build department_id based columns..  I haven't found any documentation showing how to have multiple columns summed in a pivot query yet.

Any ideas??

Thank you,

Tony Miller
LuvMuffin Software
Ruckersville, VA

This post has been answered by odie_63 on Dec 9 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2015
Added on Dec 8 2014
3 comments
3,326 views