aspose file tools*
The moose likes JDBC and the fly likes Sorting in MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Sorting in MYSQL" Watch "Sorting in MYSQL" New topic
Author

Sorting in MYSQL

Sehgal Amit
Greenhorn

Joined: Dec 28, 2000
Posts: 2
How can we print the output retrived from the database in ascending or descending order in case of "MYSQL" on the basis of 2 fields(date & time).
For example :
while(rs.next())
{
time=rs.getString("time");
date=rs.getString("date");
sendto=rs.getString("sendto");
sendfrom=rs.getString("sendfrom");
Date: <%= date %>


Time: <%= time %>


To: <%= sendto %>


From: <%= sendfrom %>


}
Vernon Gibson
Ranch Hand

Joined: Dec 01, 2000
Posts: 35
Hi,
I believe the answer to your question is to include an "Order By" clause in your query.
Good luck
VG
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sorting in MYSQL
 
Similar Threads
collections help
Timing Issues Error/normal HSQLDB/ Java doubt
ClassNotFoundException with ResourceBundle
today's date & time
Java date to MySQL date conversion