• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i group certain columns in a ResultSet

 
Tarun Chatterjee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a generic query to retrieve the result from the Database
Once the result is returned back, I want to show the information in various formats eseentially group by different columns.
Is there any way i can do that in a Result set ?
 
Susanta Chatterjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you cannot apply any of the "group by" technique on ResultSet object.

You can apply group by in the query itself, or otherwise, you can do some java coding to achieve that.
 
Tarun Chatterjee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any 3rd party framework which can do that ?
Or do i ahve to write a custom component for grouping the Data ?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You really need to write your own. There are data management tools, but its kind of a vague area since almost all database-driven applications would fall under the category of data management tools.

You can easily store the contents of the result set in an array of HashMaps since essentially a single record is equivalent to a Map. Then, you just need to sort the data over the array of maps, and/or build simplified indexes over the array as needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic