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 -> Limit a result list

Limit a result list

From: Joerg Banholzer <oracle_at_banholzer.de>
Date: Tue, 3 Dec 2002 14:31:49 +0000 (UTC)
Message-ID: <db3a76aa8fa67d1d0fbed43c2fcb20af.116041@mygate.mailgate.org>


I have the following problem:

How can I get the results (for example 30 - 39) from a select statement? The result list should by ordered by a date.

With MySQL I did it like :

SELECT * FROM tablename WHERE something ORDER BY entrydate LIMIT 30, 10

With Oracle I did it like :

SELECT *
FROM (
  SELECT *
  FROM tablename
  WHERE something
  ORDER BY entrydate
)

WHERE NUMROWS < 40
MINUS
SELECT *
FROM (
  SELECT *
  FROM tablename
  WHERE something
  ORDER BY entrydate
)

WHERE NUMROWS < 30

This query is not very efficient. Is there no better way to do that?

thanks.

-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Received on Tue Dec 03 2002 - 08:31:49 CST

Original text of this message

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