Ask a Question
Advertise on boostr.in
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"
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.
Sep 7, 2015
to add a comment.
Related Hot Questions
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please