SQL ROWNUM how to return rows between a specific range

code511788465541441 picture code511788465541441 · Dec 29, 2010 · Viewed 164.6k times · Source

How can I return a specific range of ROWNUM values?

I'm trying the following:

select * from maps006 where rownum >49 and rownum <101

This returns only rows matching the < operator.

Answer

Michael Pakhantsov picture Michael Pakhantsov · Dec 29, 2010
 SELECT * from
 (
 select m.*, rownum r
 from maps006 m
 )
 where r > 49 and r < 101