This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes rows into columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "rows into columns" Watch "rows into columns" New topic

rows into columns

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
Request a query in oracle on how to convert rows into columns?

Reason being consider below example:

Table A:

Colunms: name, id
Values: john,1

table B:
Columns:id,roll no

Now the result displayed should be as below;
name name name rollno rollno rollno
John Shan Jimmy 23 24 25

Request your help.

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3749

While there may be some clever ways to do it in SQL, I don't think it should be done this way. You should save the records to local objects and transpose the columns and rows locally. This is a presentation issue and has nothing to do with JDBC.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: rows into columns
It's not a secret anymore!