• Fetch data that fall in a rank range

    Posted on June 5th, 2007 biexplorer No comments

    This query returns all the rows that fall in a certain rank range. Please note that the second condition is rnum and not rownum. If you use rownum, nothing will be returned.

    select * from
    ( select a.*, rownum rnum from
    (select * from expense_fct where expense is not null order by expense desc) a
    where rownum <= &upperbound )
    where rnum >= &lowerbound