Posted by: Mr. Hyde March 26, 2009
SQL help
Login in to Rate this Post:     0       ?        

Try this let me know if it works:


Select d.dname as Department_Name, d.loc as Location_Name,
(select count(e.employee_id) from EMP e JOIN DEPT d ON e.deptno=d.deptno where e.deptno=d.deptno) as Number_of_People,
(select round(avg(e.salary),2) from EMP e JOIN DEPT d ON e.deptno=d.deptno where e.deptno=d.deptno) as Average_Salary
from EMP e, DEPT d
where e.deptno=d.deptno
group by d.dname

Read Full Discussion Thread for this article