Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Quesry question
Alex,
Top-N queries in Oracle 8i may be done by using analytic functions.
rem***********************************************************SELECT ename, sal
FROM (SELECT ename, sal, ROW_NUMBER() OVER (ORDER BY sal DESC NULLS LAST) AS rank
FROM emp)
WHERE rank <=10;
rem******************************************************************* ENAME SAL ---------- ---------- KING 5000 SCOTT 3000 FORD 3000 JONES 2975 BLAKE 2850 CLARK 2450 ALLEN 1600 TURNER 1500 MILLER 1300 WARD 1250
10 rows selected.
Look for 'analytic Functions for Oracle8i' white paper on metalink.oracle.com
Good luck!
Vladimir Ivanovich
Oracle DBA
Boston Medical Technologies
"Cyb3rPunk" <a.merola_at_inwind.it> wrote in message
news:9e2r3n$pbg$1_at_fe2.cs.interbusiness.it...
> Hiya all!
>
> I have a quesry question...
>
> On my MS SQL server I have made this query:
>
> Select TOP 10 * from <table>
> and it returns the first 10 results (in the resultset) of the query..
>
> Now I have the same DB on Oracle 8i, but the query doesn't work because it
> seems not to accept the "TOP 10" instruction.
>
> Can someone help me?
>
> Bye
>
> Alex
>
>
Received on Fri May 18 2001 - 15:30:50 CDT