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

Home -> Community -> Usenet -> c.d.o.server -> Re: first registers

Re: first registers

From: Mark D Powell <mark.powell_at_eds.com>
Date: 11 Jan 2002 06:19:54 -0800
Message-ID: <178d2795.0201110619.3e106c25@posting.google.com>


"Pilar Lorenzo" <pilar_lorenzo_at_latinmail.com> wrote in message news:<a1mhei$knk$1_at_talia.mad.ttd.net>...
> Hello.
> I have a select, and it has ten registers but I need only the five first.
>
> In sqlserver I can do:
>
> select top 5 * from emp;
>
> but oracle I can not do it.
>
> thanks and excuses but english.

Here is one way to return the top or bottom N:

UT1> l
  1 select ename, sal
  2 from ( select ename, sal from emp order by sal desc )   3* where rownum < 6
UT1> /

ENAME SAL
---------- ----------

KING             5000
SCOTT            3000
FORD             3000
JONES            2975
BLAKE            2850

Received on Fri Jan 11 2002 - 08:19:54 CST

Original text of this message

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