用连查
select * from (
select emp.*, avg(emp.sal) over (partition by emp.deptid) as avgsal
from emp) a
where a.sal>a.avgsal
order by emp.deptid;
select a.* from emp a, (select deptno, avg(sal) sav from emp group by deptno) b
where a.deptno = b.deptno and a.sal > b.sal