java - Execution of multiple select statements -


i want execute multiple select statements using group by.

i have tried following one:

resultset rs=s.executequery("select attr_name, count(*)"                           + " table_name"                           + " group attr_name;"                           + "select attr_name, count(*)"                           + " table_name"                           + " group attr_name"); 

but not coming.

the way join 2 sets of results use union all

resultset rs=s.executequery(   "select attr_name,count(*) table_name group attr_name union select attr_name,count(*) table_name group attr_name" ); 

be careful make sure columns same: there must same number of columns , must of same type. worth explicitly naming columns make sure: select attr_name, count(*) attr_count from...


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -