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: Limiting the resultset returned from a SELECT to the first N rows?

Re: Limiting the resultset returned from a SELECT to the first N rows?

From: Michael G. Schneider <mgs_software_at_compuserve.com>
Date: 1997/10/28
Message-ID: <01bce3d3$95d7e550$0201dede@mum>#1/1

It seems as if ROWNUM would be calculated before a sort is done. So a ...

   SELECT * FROM tbl WHERE ROWNUM<10 ORDER BY amount

does not return the 10 rows with the smallest amounts.

Is there some other possibility than ROWNUM?

Michael G. Schneider

mgs_software_at_compuserve.com

> > I would like to write a SELECT statement and limit the number of
 returned
> > rows. Something like
> >
> > SELECT * FROM tbl ORDER BY amount TOP 10
> >
> > Is this possible?
> >

> SELECT * FROM tbl ORDER BY amount WHERE ROWNUM<10
Received on Tue Oct 28 1997 - 00:00:00 CST

Original text of this message

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