select * from (select id as rownum, t.* from tablename t where rownum<=totalRecordNum) where id>=startRecordNum;