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
 
 
 
Closed TopicStart new topic
> Converting rows into columns and updating a table
LDP
post Apr 26 2012, 05:00 AM
Post #1


Newbie
*

Group: Members
Posts: 3
Joined: 20-June 11
Member No.: 45,397



Hi,
I have a table A, whose table structure is in the below format.

Table A

ID DESC VALUE
123 A 454
123 B 1111
123 C 111
123 D 222
124 A 123
124 B 1
124 C 111
124 D 44

Now i need to insert the data from this table to another table B, the sturcture of which is as below

Table B

ID A B C D
123 454 1111 111 222
124 123 1 111 44

How do i frame a query to fetch data from table A and insert that into table B? Please help. I don't want to use max and decode combination. as it would return only single row for an ID. I need all the id's to be displayed.
Go to the top of the page
 
+Quote Post
burleson
post Apr 26 2012, 10:13 AM
Post #2


Advanced Member
***

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



Hi,

Here is how to convert rows to columns:

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

As for inserting, that should be self-evident! See here for complete details:

http://www.rampant-books.com/book_0902_easy_sql.htm

Good Luck!


--------------------
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

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th December 2014 - 05:39 PM