Union of two queries with the first query resultset getting the first ten rownums in Oracle
I want Union of two queries with the first query resultset getting the开发者_运维问答 first ten rownums in Oracle. Example: Like if first query has 10 rows and max rownum is 10.I want second query rownum to be started from 11 in the result of union.
SELECT *
FROM (
SELECT *
FROM table1
ORDER BY
col1
)
WHERE rownum <= 10
UNION ALL
SELECT *
FROM (
SELECT *, rownum AS rn
FROM (
SELECT *
FROM table2
ORDER BY
col2
)
)
WHERE rn > 10
精彩评论