number of rows returned
| From: | (Pedro Garre) | Date: | Wed, 02 Aug 2000 10:59:28 +0000 |
| Subject: | number of rows returned | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1705@lists.php.net to get a copy of this message | ||
Hi,
I want to get only the first 4 rows from a query. The query is complex, and
has an order by statement.
Oracle documentation states that ROWNUM is assigned before rows are sorted,
so I understand that this will _not_ work as desired:
select ...
from ...
where ...
and ROWNUM < 4
order by ...
In Postgresql you just need to include "LIMIT 4".
I also want to retrieve rows 4 to 6, but no clue how to do it.
In Postgresql is as easy as "LIMIT 4,3" (or something similar).
Anybody knows how to do that with Oracle (the most expensive database in the
world) ?
Thanks in advance,
Pedro.