Possible Duplicate:
How do I limit the number of rows returned by an Oracle query after ordering?如何實現Oracle查詢限制或分頁
我使用就像下面的查詢:
SELECT url, title, metadesc FROM (
SELECT url,title, metadesc, rownum rn FROM (
SELECT url, title, metadesc FROM web
)
WHERE rownum <= 60
)
WHERE rn > 50
它工作正常,單表,但在我的主查詢,如果不加入 即
SELECT name, id, url, title, metadesc
FROM web, emp
然後它給了我錯誤:
java.sql.SQLException: ORA-00918: column ambiguously defined
請參閱:http://stackoverflow.com/questions/470542/how-do-i-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering? rq = 1 – esmoreno
從Oracle 12cR1開始,你可以使用'OFFSET'和'FETCH NEXT n ROWS':http://stackoverflow.com/a/26051830/1461424 – Krumia