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 query result with twist

PericlesJun 8 2024

Hello

I have the following table:

MONTHS_PLANNING

Being M0 for the past month, M1 for current Month, M2 for the next month and so on.

I want to transform this table to this:

Making the sum for the M0 to M3 grouping by Customer is simple, but replacing the M# with a tag for the month have left me without any idea.

Wonder if anyone has some idea how to handle this without writing a separate query for each M# and making the union between them.

Thanks

This post has been answered by Mike Kutz on Jun 8 2024
Jump to Answer
Comments
Post Details
Added on Jun 8 2024
5 comments
402 views