aspose file tools
The moose likes JDBC and the fly likes rows into columns Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "rows into columns" Watch "rows into columns" New topic
Author

rows into columns

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
Hi,
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
shan,2
jimmy,3

table B:
Columns:id,roll no
1,23
2,24
3,25

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


Request your help.


Thanks,
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3652

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.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rows into columns
 
Similar Threads
How to give hyperlink to a row in a table which is XML data
How to parse string with separators
'A HREF = a row in Database' for each req_id in Servlets
sorting a resultset
How to update value using struts