Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases and the fly likes Sorting in MYSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Sorting in MYSQL