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: Chen, Yongbiao(³ÂÓ¾±ê) <ChenYB_at_unforgettable.com>
Date: 1997/10/30
Message-ID: <34585785.21785EA@unforgettable.com>#1/1

Gee M Wong wrote:

> Try
>
> SELECT * FROM
> (SELECT * FROM TABLE ORDER BY AMOUNT)
> WHERE ROWNUM <= 10;

This can not work. An oracle error issued. ORA-00907: missing right parenthesis.You can try this:

select a.amount from table a,table b
where a.amount<=b.amount
group by a.amount
having count(*)<=10;

But it'll be too slow when selecting a large table. Does anyone know the faster way?

Chen Yongbiao Received on Thu Oct 30 1997 - 00:00:00 CST

Original text of this message

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