Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Ultimate Question: Oracle, MSSQL, Others vs MYSQL LIMIT Statement
Philip Nelson <pandp_at_attglobal.net> wrote in message news:<pan.2002.09.17.13.25.07.407715.2181_at_attglobal.net>...
> Steve,
>
> Here's (from memory) what DB2 offers in this area.
>
> It's called the "FETCH FIRST n ROWS" clause.
>
> So you would code -
>
> SELECT username FROM users_table ORDER BY username FETCH FIRST 10 ROWS
> ONLY
>
It's also possible to fetch any "window", rather than just the first n rows, using an OLAP function, e.g.:
SELECT
a.username
FROM
(
SELECT
ROW_NUMBER() OVER (ORDER BY username) AS row_number, username FROM users_table
Jeremy Rickard Received on Wed Sep 18 2002 - 06:07:57 CDT