oracle - SQL: AVG with NULL Values -


as far understood avg() function ignores null values.

so avg(4,4,4,4,4,null) --> 4

in case don´t want happen.

i need solution that: avg(4,4,4,4,4,null) --> 3,33

without replacing null values directly in table itself. there way this?

use coalesce() return real value of 0 null columns:

select avg(coalesce(some_column, 0)) ... 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -