I have this oracle sql which gives me a subset of records for paging. I also need the total of records, can I combine the two queries ? The real query is much more complicated (union with where etc), I simplified it to not distract from my question.
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;
obviously something like the following doesn't work
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;