I have a question about data grouping in java. Suppose I wanted to group data from a query followed by detail records for that group. For example, if I have 2 tables (employee and department) and I wanted my data formatted as follows...
Is there an easy way to group data in this fasion in java after receiving from a query?
Thanks...
stu derby
Ranch Hand
Joined: Dec 15, 2005
Posts: 333
posted
0
In your query, use an ORDER BY clause to order the ResultSet by department (and any secondary ordering you want, such as last name, first name).
In your Java, whenever the department changes, print (or whatever) a new department header, then start printing (or whatever) the row information for each employee.