Again u r using rownum in the where clause , just forget the rownum,Quote:
Did I miss something here?..
select empno,ename,sal from (select empno,ename,sal, rank()
over(order by sal desc) sal1 from emp)
where rownum<=5000;
now the rank function will order ur salary and the ranks are in
SAL1 ( *** NOT sal) , so in where clause ask for top 10 rankers .
so it shud b like this
select empno,ename,sal from (select empno,ename,sal, rank()
over(order by sal desc) sal1 from emp)
where sal1<=10 ;
here sal1 is not the salary column ie ( SAL in ur query , u r talking abt MAX(sal) and MIN(sal) , iam talking abt sal1 )this is rank, u shud get the top 10 rank holders,
NO MORE ROWNUM , if u want to do it with rownum u don need RANK(),in tat case u can use the query given by Stmontgo in his reply.
hope this works for u .......
Akila Rajakumar
