This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 206

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: 206



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
 
 
subject: group by query
 
Similar Threads
Query question
SQL Having Clause
SQL questions
Values not retireved using rownum in oracle
Need help with a query (HQL)