aspose file tools*
The moose likes JDBC and the fly likes group by query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "group by query" Watch "group by query" New topic
Author

group by query

Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 211

Hi all,

I have a jsp page in that I am getting data from two tables and want to particular data which I am select but group by query in not working properly



please suggest me in the right way


Thanks in advanced
Harsha Gedala
Ranch Hand

Joined: Jun 04, 2008
Posts: 41

Query is wrong. You should use all the selected columns in the group by operation to get the result. For better understanding whether the query is working or not, please run the query in DB then try to implement it in JSP.
Rd Dari
Ranch Hand

Joined: Feb 22, 2010
Posts: 211



its not wrking .........



wht is wrong in this query..........
Harsha Gedala
Ranch Hand

Joined: Jun 04, 2008
Posts: 41

appartment.society_name=society.society_name='"+resi_society+"'


I guess you are new to DML sql statements. Here you go this should work. you cannot reassign something like above.


Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

What exactly are you trying to do with the query? From the looks of it, there is no reason to use a GROUP BY clause since you are not performing any aggregate function in the query. I think you might want to use an ORDER BY clause instead.


OCJP6, OCWCD5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: group by query