Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL Select TOP in Oracle

Re: SQL Select TOP in Oracle

From: <steveee_ca_at_my-deja.com>
Date: Fri, 19 Jan 2001 17:33:10 GMT
Message-ID: <949tom$ofo$1@nnrp1.deja.com>

Hi,

Depending on your version of Oracle, you can:

SQL> select empno,ename,sal from
  2 (select empno,ename,sal from emp order by sal desc)   3 where rownum <11;

     EMPNO ENAME                       SAL
---------- -------------------- ----------
      8975 MACKINGSON                 5560
      9975 MACKINGSONSMITH            5560
      .
      .
      .
      9038 MACFORDSON                 3560

10 rows selected.

Hopefully this helps,

Steve

In article <RRZ96.3505$wL5.47074_at_NewsReader>,   "JF" <john.fitzgerald_at_mainframe.co.uk> wrote:
> How do I limit the number of records returned in a select query i.e.
 in SQL
> Server 7+ the following works
>
> Select Top 10 * from STUDENTS where DEPT =44 order by STUID
>
> Which will return the first 10 students
>
> I've tried looking in Oracle docs and can't find an equivalent to TOP
> Help
>
> JF
>
>

Sent via Deja.com
http://www.deja.com/ Received on Fri Jan 19 2001 - 11:33:10 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US