Is there a way to make an Oracle
query behave like it contains a MySQL limit
clause?
In MySQL
, I can do this:
Same as above with corrections. Works but definitely not pretty.
WITH
base AS
(
select * -- get the table
from sometable
order by name -- in the desired order
),
twenty AS
(
select * -- get the first 30 rows
from base
where rownum <= 30
order by name -- in the desired order
)
select * -- then get rows 21 .. 30
from twenty
where rownum < 20
order by name -- in the desired order
Honestly, better to use the above answers.