Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> Convert rows to columns in a table.
BujjigaduVZM
post Apr 24 2012, 05:17 AM
Post #1


Newbie
*

Group: Members
Posts: 2
Joined: 24-April 12
Member No.: 47,125



How do I convert rows in oracle table to columns by writing a query?
Here is my table.

EID QNo Qual YOP
101 1 B.Tech 2004
101 2 M.Tech 2006
102 1 B.Tech 2003
102 2 M.Tech 2005
102 3 MBA 2007

Now I want the above table in the following format......

EID Qual1 YOP1 Qual2 Yop2 Qual3 Yop3
101 B. Tech 2004 M.Tech 2006
102 B. Tech 2003 M.Tech 2005 MBA 2007

I have maximum of 8 Qualifications, please let me know how to achieve this in oracle.

Thanks in advance.
Go to the top of the page
 
+Quote Post
burleson
post Apr 24 2012, 01:11 PM
Post #2


Advanced Member
***

Group: Members
Posts: 11,640
Joined: 26-January 04
Member No.: 13



See here:



http://www.dba-oracle.com/t_converting_rows_columns.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
BujjigaduVZM
post Apr 24 2012, 11:03 PM
Post #3


Newbie
*

Group: Members
Posts: 2
Joined: 24-April 12
Member No.: 47,125



QUOTE (burleson @ Apr 24 2012, 01:11 PM) *




Hi,

Thanks for the reply, it's good, but i wanted the result in different columns not in a single column.

Go to the top of the page
 
+Quote Post
burleson
post Apr 25 2012, 12:35 PM
Post #4


Advanced Member
***

Group: Members
Posts: 11,640
Joined: 26-January 04
Member No.: 13



Try this:



http://www.dba-oracle.com/t_display_multip...s_same_rows.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 1st November 2014 - 03:54 AM