Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sorting in MYSQL

 
Sehgal Amit
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I believe the answer to your question is to include an "Order By" clause in your query.
Good luck
VG
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic