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

Home -> Community -> Usenet -> c.d.o.misc -> Re: First 20 records from a select, after ordering

Re: First 20 records from a select, after ordering

From: -=< a q u a b u b b l e >=- <aquabubble_at_Remove.No.Parma.Ham.Remove.geocities.com>
Date: Sun, 31 Oct 1999 20:21:46 -0000
Message-ID: <7vilka$sgj$1@news4.svr.pol.co.uk>


Jill <jc_va_at_hotmail.com> wrote in message news:7vhcac$ath$1_at_bgtnsc03.worldnet.att.net...
> -=< a q u a b u b b l e >=-
> <aquabubble_at_Remove.No.Parma.Ham.Remove.geocities.com> wrote in message
> news:7vehtk$qe6$1_at_news5.svr.pol.co.uk...
> > Billy Collins <billy_collins_at_my-deja.com> wrote in message
> > news:7vdhmg$mr4$1_at_nnrp1.deja.com...
> > > Hi,
> > >
> > > Is there a way for me to retrieve only the first 20 rows from oracle
> > > AFTER doing an ORDER BY?
> > >
> > > The rownum is executed while the SELECT is executing, as discussed in
a
> > > recent thread, and this gets distorted after sorting is done. I wish
to
> > > retrieve only the first 20 records after this sorting..
> > >
> > > SELECT FIRST 20 <column_name> FROM <tablename> ORDER BY <column_name>
> >
> > If you don't want to use PL/SQL then you could do something like this:
> >
> > SELECT *
> > FROM (SELECT <columns>
> > FROM <tablename>
> > ORDER BY <column>)
> > WHERE rownum < 21
> >
> > This would do your job. HTH

>

> I thought this was only available in 8i, not 8....
>
I don't see why it wouldn't work in earlier versions than that. Received on Sun Oct 31 1999 - 14:21:46 CST

Original text of this message

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