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

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -