aspose file tools*
The moose likes JDBC and the fly likes SQL : Aggregate functions and Group By clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL : Aggregate functions and Group By clause" Watch "SQL : Aggregate functions and Group By clause" New topic
Author

SQL : Aggregate functions and Group By clause

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

If an Aggregate function is used , is it mandatory to use the Group By clause ??



Save India From Corruption - Anna Hazare.
manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
Yes, it is.

Think... what are you aggregating on without "group by"?


love your job and not your company;
...because you never know when your company will stop loving you!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30919
    
158

No. Consider this SQL:


You do need group by if you have any columns in the group by that are not part of the aggregate function.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you .

I have gone through some tutorials and understood the concepts of Group By clause.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL : Aggregate functions and Group By clause