我有这个 oracle sql,它为我提供了一个用于分页的记录子集。我还需要记录总数,我可以结合这两个查询吗?真正的查询要复杂得多(与 where 等联合),我对其进行了简化,以免分散我的问题。
select count(*) from table;
select outerfields.* from
(select row_number() over (order by id asc) r, innerfields.* from
( (select * from table) innerfields)) outerfields where r between 1 and 10;
显然像下面这样的东西不起作用
select max(r), outerfields.* from
(select row_number() over (order by id asc) r, innerfields.*
from ( (select * from m30brief) innerfields)) outerfields where r between 1 and 10;