This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes sorting a resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "sorting a resultset" Watch "sorting a resultset" New topic

sorting a resultset

Kristof Camelbeke
Ranch Hand

Joined: Nov 28, 2001
Posts: 97
I finally made a connection through a ms-access database.
In the database I have a key on the field name so it is sorted.
But in my resultset this is ignored !?!
How can i sort this ? I have tried to to use group by in the sql-statement but this is not allowed since I select everything (select * from .....)
Can anybody help me out ?
Here is some code :
// create a statement handlez
Statement sqlStatement = databaseConnection.createStatement();

// create a sql-string
String sql = "SELECT * FROM VELD";
ResultSet results = sqlStatement.executeQuery(sql);

while ({

// close connection
System.out.println("the connection is closed !");

} catch (SQLException sqle) {
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
wouldnt this work?
select rollno,fname,lname from veld order by rollno
the columns are taken as assumption.....

regards,<br />Dharmesh Chheda
I agree. Here's the link:
subject: sorting a resultset
jQuery in Action, 3rd edition