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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

PIVOT in Oracle

sanJun 29 2018 — edited Jul 10 2018

Hi All,

I am trying to create a pivot query using the below test data

My table looks like

City          Group  agent  paymentdate actno

Chennai   South  X1       05/01/2018 .1

Bangalore south D1       05/02/2018.  2

Delhi.         North C1.      05/02/2018.  3

Chennai.   South. B1.     05/01/2018.  4

Chennai .  South. X1 .    05/01/2018.   5

I am trying to get the output as below

City Group agent 05/01/2018 05/02/2018 05/03/2018

Chennai south X1   2.                    0.                 0

Bangalore south D1 0.                  1.                  0

Delhi.    North .  C1.  0.                  1                   0

Chennai South . B1.  1 .                 0 .                0

Note : Date will dynamic for the month. I have to display data for the month

I tired with PiVot but I have to hardcode the value in for In clause.

How to pass it as dynamic? Or is there any other way to achieve this?

Thanks in advance.

Cheers

San

This post has been answered by Etbin on Jun 29 2018
Jump to Answer

Comments

591186
You can check here.

http://www.oracle.com/pls/db111/portal.portal_db?selected=11&frame=#aix_installation_guides

-Anantha
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 7 2018
Added on Jun 29 2018
16 comments
886 views