| Author |
How can i group certain columns in a ResultSet
|
Tarun Chatterjee
Greenhorn
Joined: Mar 07, 2005
Posts: 25
|
|
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
Joined: Aug 12, 2002
Posts: 102
|
|
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
Joined: Mar 07, 2005
Posts: 25
|
|
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
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3666
|
|
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.
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
 |
|
|
subject: How can i group certain columns in a ResultSet
|
|
|