Home » SQL & PL/SQL » SQL & PL/SQL » performing transpose on table data (merged) (Oracle 11g / Windows)
performing transpose on table data (merged) [message #422471] Wed, 16 September 2009 13:33 Go to next message
Messages: 1
Registered: September 2009
Location: India
Junior Member

I need to perform some sort of a transpose in here. Basically, what I have right now is a table with two columns (Name and Phone)

X 12345
X 78908
X 77777
Y 880983
Y 233422
Z 2234534
Z 11235813
Z 9820303
W 60708

What I need is the data in the following format:

X 12345 78908 77777 blank blank
Y 880983 233422 blank blank blank
Z 2234534 11235813 9820303 blank blank
W 60708 blank blank blank blank

Can someone suggest a good function (like a transpose as such)?

Re: performing transpose on table data (merged) [message #422475 is a reply to message #422471] Wed, 16 September 2009 13:44 Go to previous message
Michel Cadot
Messages: 65084
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is a FAQ asked several times EACH week.
Please search BEFORE posting; here search for "PIVOT" (and you can do it in SQL Reference also).

And please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.

Post a working Test case: create table and insert statements along with the result you want with these data.


[Updated on: Wed, 16 September 2009 13:45]

Report message to a moderator

Previous Topic: Exception handling using update
Next Topic: Left Outer Joins - query is too slow
Goto Forum:

Current Time: Sun Jul 23 00:09:45 CDT 2017

Total time taken to generate the page: 0.06444 seconds