Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
problem is average function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
meetsrk

Active User


Joined: 13 Jun 2004
Posts: 86

PostPosted: Tue Jul 06, 2004 9:50 pm    Post subject: problem is average function
Reply with quote

hi ppl,

when we are using average function in a query for a table where some of the salary are null then wat will be the output of the following query,

Code:

select avg(salary) from emp


say emp has 10 records out of which 3 records are having NULL value.

so will it calculate the sum of the all the salaries irrespective of NULL(taking nulls as zero) and divides by 10.

or

will it calculate the sum of all the salaries which does not have NULL and divide it by 7
Back to top
View user's profile Send private message
References
imvs

New User


Joined: 12 May 2004
Posts: 33

PostPosted: Tue Jul 06, 2004 11:28 pm    Post subject:
Reply with quote

check the second question of this post
http://ibmmainframes.com/expertforum/viewtopic.php?t=785
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1