Bookmark Topic Watch Topic
  • New Topic

Sort a ResultSet based on data in one of the ResultSet Columns

 
Dar Var
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

Does anyone know how the sort a ResultSet based on data in one of the ResultSet Columns?

NOTE: I do not want to run a modified query to do the sorting.

The ResultSet may contain a text column. I need to resort the ResultSet alphabetically based on this text column.

The resulting ResultSet should return for example:
Row Text Column
1 aaaa
2 bbbb
3 cccc
etc...
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Which database? I'd suggest to use temporary sorted array to insert all records from ResultSet in sorted order. This approach can be more portable. However if you use paganation it can bring incomplete data.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4031
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Report post to moderator
Duplicate post. And the answer is you have to modify the query. I'll post a longer answer in your original post on why.
[ July 19, 2007: Message edited by: Scott Selikoff ]
 
    Bookmark Topic Watch Topic
  • New Topic