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!

How to rotate table?

NeqDec 2 2013 — edited Dec 2 2013

Hi, I have some query that produces following result:

A                 B                  C                  D              
----------------- ------------------ ------------------ ------------------
DATE              2013-01-31         2013-02-28         2013-03-31       
VALUE1            552488.86520999996 553429.08377000003 548169.86664999998

VALUE2            26883.37285        24362.411590000003 24697.108139999997

I would like to do 'simple' transposition and get result like this:

DATE              VALUE1             VALUE2

----------------- ------------------ ------------------

2013-01-31        552488.86520999996 26883.37285      

2013-02-28        553429.08377000003 24362.411590000003

2013-03-31        548169.86664999998 24697.108139999997


Now, if I use PIVOT clause, I get everything in one row only with different colums names. If I use UNPIVOT I get only two columns with mixed values and dates. It's quite useless for me...

So, how to achieve this? I search for quite simple solution, because real dataset is much, much larger and I would to avoid dynamic, monster queries :P


Db version: 11.2.0.3.0

This post has been answered by Ramin Hashimzadeh on Dec 2 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 30 2013
Added on Dec 2 2013
2 comments
2,109 views