SQL> select deptno,  2  max(decode(seq,1,ename,null)) highest,  3  max(decode(seq,2,ename,null)) second,  4  max(decode(seq,3,ename,null)) third  5  from (  6  select deptno,ename,  7  row_number() over  8  (partition by deptno order by sal desc) seq  9  from emp) 10  where seq <=3 group by deptno 11  /DEPTNO HIGHEST    SECOND     THIRD---------- ---------- ---------- ----------10 KING       CLARK      MILLER20 SCOTT      FORD       JONES30 BLAKE      ALLEN      TURNER  |