oracle分组查询
查找出部门10和20中,工资最高1到2名的员工名字、部门名字、部门位置
select b.ename,a.dname,a.loc from dept a,
(
select * from(
select ename,sal,deptno,row_number() over(partition by deptno order by sal desc)rank
from EMP)a where a.rank between 1 and 2
)b where a.deptno=b.deptno and b.deptno between 10 and 20