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!

first column replaced to rows

GTAJul 1 2011 — edited Jul 4 2011
Hi friends,

I have a 13 columns in a report and these are those columns

*) Name *)q1 *)rating1 *)q2 *)rating2 *)q3 *)rating3 *)q4 *)rating4 *)suggestion1 *)suggestion2 *)suggestion3 *)suggestion4

For these three columns i have 10 rows with values as shown below

RESULT---1
*name----q1----rating1---q2--rating2---q3---rating3---q4---rating4----suggestion1--suggestion2---suggestion3---suggestion4*----------> *headings of the each column*

A-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
B-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
C-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
D-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
E-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
F-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
G-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
H-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
I-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
J-------B-------C-------D----E---------F-----G--------H-----I-------------N----------O--------------P-------------Q
i need to convert the above result to the below like

RESULT----2
*questions-------A-------B---------C---------D--------E-------F-------G-------H--------I-------J*--------------->  *headings of the each column*
B---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion1-----N-------N---------N---------N--------N-------N-------N-------N--------N-------N
D---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion2-----O-------O---------O---------O--------O-------O-------O-------O--------O-------O
F---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion3-----P-------P---------P---------P--------P-------P-------P-------P--------P-------P
H---------------C-------E---------G---------I--------C-------E-------G-------E--------I-------E
suggestion4-----Q-------Q---------Q---------Q--------Q-------Q-------Q-------Q--------Q-------Q
where rating value is -----------C,E,G,I(any four)

where q1,q2,q3,q4 is---------B,D,F,H

In the first result above i had the columns HEADINGS like(name, q1, rating1, suggestion1...etc).

I need that column HEADING to be converted into the second result column HEADING like(questions, A, B, C, D, E, F, G, H, I, J)

AND the value of q1,q2,q3,q4 is same like( B, D, F, H)....I need B, D, F, H to be a separate row for the first column "questions" as shown in result2 along with suggestion1, suggestion2, suggestion3, suggestion4.

How it is possible to acheive the result1 to be to result2. i have result1 with me now, how i can able to convert it to result2 friends. Kindly help me with this sorting arrangement with the help of query.

Simply if we say means, it is like a "Transpose" option in Excel. in which the first column will be replaced by first row.

Help me with this issue friends.

Thanks

All izz Well
GTA.

Edited by: GTA on Jul 1, 2011 8:51 AM

Edited by: GTA on Jul 1, 2011 9:39 AM
This post has been answered by sKr on Jul 4 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2011
Added on Jul 1 2011
12 comments
208 views