Foxhole Atheist
Monday, March 19, 2012
Nulls in avg and count
select
sum
(
a
)
/
count
(
a
)
[homemade average - count doesnt count nulls]
,
avg
(
isnull
(
a
,
0
))
[average with isnull]
,
avg
(
a
)
[regular average]
from
(
select
null
a
union
select
0
union
select
5
union
select
15
)
main
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment