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!

Convert row values to columns in sql

Anjlesh RaiApr 11 2018 — edited Apr 12 2018

Hi All,

I have a sql query .

o/p :

id     owner    sales          month

1       mohan     5                 sept-17

2      sohan       6                 Oct-17

3      mohit        2                  Nov-17

4      abdul       19                 Dec-17

required O/p:

id     owner     sept-17  Oct-17   Nov-17   Dec-17

1       mohan     5           

2      sohan                    6         

3      mohit                                     2           

4      abdul                                                     19

Now my month column value is not fixed its depend on my where clause ,some time its 4 and some times it may be 20 so i can not use direct PIVOT function.

Kindly suggest me some approach.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2018
Added on Apr 11 2018
20 comments
1,612 views