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!

Pivot in oracle

syed haiderDec 18 2018 — edited Dec 18 2018

Following is my code snippet.

select distinct *
from
         rpt_pivot_data
             pivot (
                     sum(numeric_6)
                     for (numeric_3)
                     in ('Q1' as "1Q",
                         'Q2' as "2Q",
                         'Q3' as "3Q",
                         'Q4' as "4Q",
                         'no_show_Q1',
                         'no_show_Q2',
                         'no_show_Q3',
                         'no_show_Q4',
                         'ytd' as "YTD")
                    )

I want the 'no_show_Q1' to appear under 1Q,'no_show_Q2' to appear under 2Q, 'no_show_Q3' to appear under 3Q, and 'no_show_Q4' to appear under 4Q.

Please suggest as to how I can accomplish this task. Thank you in advance!

I'm not providing with the data or tables thinking there might be a quick answer to my question. Please let me know if I still need to provide tables and data.

Thanks!

This post has been answered by mathguy on Dec 18 2018
Jump to Answer
Comments
Post Details
Added on Dec 18 2018
5 comments
337 views