select * from (select s.*, row_number() over(ORDER BY rownum) id_tj, COUNT(1) over() ID_TJ_ALL from (sql) s) where id_tj between 11 and 20