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: Oracle Newbie : Getting only limited number of rows

Re: Oracle Newbie : Getting only limited number of rows

From: Peter Chang <p-chang_at_ti.com>
Date: 1998/06/12
Message-ID: <358136A1.F59E1829@ti.com>#1/1

Because sort order is done befor rownum.

For top 10 recored

select a.ord_col, a.other_stuff
  from table_name a
 where 10 > (select count(*) from table_name b where b.ord_col<a.ord_col)  order by a.ord_col

avaneesh.arora wrote:

> HI,
>
> I have the following problem :
>
> I want to select a limited number of rows from a table sorted on a
> particular set of columns. How do I structure my query to get, say Next N
> rows(50/100) based on the specified sort order. Limiting it by ROWNUM limits
> the row count and does not work as desired.
>
> Please help.
> Thanks,
> Avaneesh
Received on Fri Jun 12 1998 - 00:00:00 CDT

Original text of this message

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