This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I am getting records from database like this in a while loop
I need to get the sum of second column grouped by empid .I can achieve this by giving group by clause in sql query but i cant give group by clause in query since the query is a union query .How can we group the records using java .My desired output for above query is
Hi, I have not touch JDBC for a while now, but what I know is you have to execute the SQL statement on the database itself from java then retrieve the data into the program, using java.sql so you need to execute something like this on the database inside java: SELECT EmpId, COUNT(*) AS some_column FROM table_name GROUP BY EmpId ORDER BY EmpId hope this helps.