其实可以跳出avg(count(,直接用count总人数除count部门数来求平均:select count(distinct empno)/count(distinct deptno)
select t1.*, t2.sfrom emp_hiloo t1 join (select deptno, avg(salary) s from emp_hiloo group by deptno) t2
on t1.deptno=t2.deptno
where t1.salary>t2.s
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)