The emp table contains these columns:
EmpName Varchar2 (25)
Salary Number7, 2
You need to display the names of employees on more than an average salary of all employees.
Why does this fail to work :

select EmpName,salary from emp having salary > avg(salary) group by empname,salary ;

I get output as : No rows selected

But when i use sub- query the o/p is perfect :

select EmpName,salary from emp where salary > (select avg(salary) from emp) ;

Why is it so? Please help me.