select * from (select a.*,rownum rn from (select * from tablename) a where rownum2