------------------------------------------------------------------------------------------------------------------------------------------ 回复:[求助]关于oracle分组后组外排序的问题
selelct t1.*
from (select DEPTNO ,ENAME ,SAL , row_number() over(partition by deptno order by sal desc) top3 from tableName) t1,
(select rownum seq,depno from (select deptno ,max(sal) from tablename group by depno order by max(sal) desc)) t2
where t1.deptno=t2.deptno order by t2.seq,t1.sal desc;