*
The moose likes JDBC and the fly likes displaying data resulting from a query select statment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "displaying data resulting from a query select statment" Watch "displaying data resulting from a query select statment" New topic
Author

displaying data resulting from a query select statment

Shirley Li
Greenhorn

Joined: Sep 22, 2000
Posts: 14
Hi,
I am just wondering if anyone have any suggestions for me:
Right now, I am working on connecting to the DB and to display the data. It should be pretty straight forward using JDBC. However, I have a problem with displaying the data. I am pulling out the price for 5 consecutive days for each ID. So, the way the data displays on the DB is 5 seperate rows with one ID. The way I want to do it is 5 days price on one row, next to each other with the corresponding ID.
Any suggestions on how to do this will be greatly appreciated!
thanks much,
shirley
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
May be this will help...
For each row read, check the ID, if it is the same as the previous row's ID, write it on the same line using print. Else, write it on the next line using println.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Shirley,
You'll have to do this via code. You can't get the JDBC to return you 1 row if the database really contains 5 rows to hold the information.
-Peter
Shirley Li
Greenhorn

Joined: Sep 22, 2000
Posts: 14
hi, Bosun,
Thanks very much!! i'll try that.
shirley
Shirley Li
Greenhorn

Joined: Sep 22, 2000
Posts: 14
thanks, peter
Originally posted by Peter Tran:
Shirley,
You'll have to do this via code. You can't get the JDBC to return you 1 row if the database really contains 5 rows to hold the information.
-Peter

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: displaying data resulting from a query select statment
 
Similar Threads
Need Help in Sorting Multiple columns!
Handling multiple forms with spring 3 MVC
performance issue with DIV tags
Design question: Large XML Data in Web Services
Jackcess