Organizational Research By

Surprising Reserch Topic

find value smaller than average in oracle sql using -'sql,oracle,average'


find value smaller than average in oracle sql  using -'sql,oracle,average'

I have this code:

select username,first_name,last_name,nvl(salary,0) "salary"
from customer
where nvl(salary,0) < avg(nvl(salary,0));


Trying to find out which users have lower salary than average and one user has no salary ("null" which I must convert to 0).

The last statement "avg(nvl(salary,0))" doesn't work and I can't for the life of me figure out why. If I replace the statement with the actual number of the average everything works just fine.
    
asked Sep 7, 2015 by rajesh
0 votes
5 views



Related Hot Questions



Government Jobs Opening


...