select * from(select top m-n+1 * from (select top m * from table1 order by id asc) as table2 order by id desc) as table3 order by id