Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Limiting the resultset returned from a SELECT to the first N rows?
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