This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes SQL Results Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Results" Watch "SQL Results" New topic
Author

SQL Results

Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
Hello,

I want to display results in a sql in the format mentioned below.

Category is a column in one table and answrs are in another table and id is the join to connect these tables.

Category 1
Answr 1
Answr 2
Answr 3

Category 2
Answr 1
Answr 2
Answr 3
so forth.


Never take anything for granted because you never know when you will lose it
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
Thanks a lot.
Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
How can return more than one string in the same method. i.e. I want category and answr to be return?

How multiple return possible in java?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

Cosmos,
You can create an object and put those fields in the object. Or if for reason you can't create a new object, you can use a HashMap with the name as key and the value what you want to return.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
Could kindly give an example of the same code?

Thanks
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

For HashMap




For Object you need to create a Value Object to hold these values



Then use the value object in your code




Then in your code you can use list as below




Shailesh
[ June 12, 2006: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
Thanks a lot and much appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Results