IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding Group by clause


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
skumars.tripathi

New User


Joined: 27 May 2010
Posts: 12
Location: Kolkata

PostPosted: Thu Jul 15, 2010 4:41 pm
Reply with quote

Is it necessary that all the columns used in agregate function should be present in the Group by clause?

For ex. If i have used some column name in the SUM function, then that should also be there in Group by clause.

Thanks in advance
Sanjay
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Jul 15, 2010 4:53 pm
Reply with quote

No , exactly the opposite : all selected columns NOT in aggregate functions must be in the group by clause.
well, kind of. it gets more complicated when using functions like substr() , year(),...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
No new posts SORT HELP - SORT A COLUMN and GROUP B... DFSORT/ICETOOL 9
Search our Forums:

Back to Top