On load I am getting only 20 records(max limit for the page is 20 records) out of 1000 records sorted by "Create_date desc". Now I want to perform sorting on these 1000 records only which should be ordered by SCHEDULE_ID ASC/DESC.
Following is the query :
select *
from (
select *
from (
select SCHEDULE_ID,
DEPARTMENT,
STATUS,
CREATE_DATE,
rownum ano
from M_T_NEMO
where STATUS like 2
AND ROWNUM <= 1000
ORDER BY CREATE_DATE DESC
)
ORDER BY SCHEDULE_ID ASC
)
where ano >= 0
AND ano <= 20
Per page there can be only 20 records. Is this query correct? Right now it is only sorting 20 records per page which is wrong.