If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Functions Queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-09, 10:34
denisvenis denisvenis is offline
Registered User
 
Join Date: Dec 2008
Posts: 29
DB2 Functions Queries

What are the rules for folloiwng 2 function scenarios,

1) we can not write two or more functions in same select statement?
2) we can not use nested functions like sum(avg(salary)) group by
employee_id?

Please give link explaining in detail for this will be more helpful.
If you having any docs for this then mail it to denisvenis@gmail.com


Thanks,
Denis.
Reply With Quote
  #2 (permalink)  
Old 09-22-09, 12:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
It probably depends on which functions you are talking about. You can certainly use 2 or more functions, or nested functions, for many of the functions, but there may limitations on the ones that require some arithmetic.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 09-28-09, 06:25
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
What does "we can not ..." mean? Do you get an error message or other results than what you expect?

An expression like "SUM(AVG(salary))" is syntactically possible, of course. But the SUM() is not needed because it won't change the result at all. So it really depends on what you want to achieve.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 09-28-09, 07:29
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Quote:
Originally Posted by stolze
An expression like "SUM(AVG(salary))" is syntactically possible, of course.
An aggregate function must not include another aggregate function. SQLCODE = -112
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On