Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要两个查询的联合,第一个查询结果集在 Oracle 中获得前十个 rownums。示例:如果第一个查询有 10 行并且最大 rownum 为 10。我希望第二个查询 rownum 在联合结果中从 11 开始。
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