Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to select a range of records by rownum?
Pao Wan wrote:
>
> I want to select records from 40 to 100, and I think the statement
>
> "select rownum, user, email from clients where rownum >= 40 and rownum
<=100"
>
> will work. But it failed, I tried
>
> "select rownum, user, email from clients where rownum <= 100"
>
> it work. But
>
> "select rownum, user, email from clients where rownum >= 40" failed, can
> anybody help me.
The where clause is evaluated for each record the query may return: The first record is checked, rownum = 1, so it doesn't satisfy the where clause. The second record is checked, again rownum = 1 (because no records are yet returned), and again it doesn't satisfy the where clause. And so on...
You can solve it by using something like:
select ..... where rownum <=100
minus
select ..... where rownum <40
Stefan.
Name :G.R.S. Deisz Phone :+31-50-5855954 E mail :G.R.S.Deisz_at_PTT-Telecom.Unisource.NL DISCLAIMER:This statement is not an official statement from, nor does it represent an official position of, PTT Telecom BV.Received on Tue Mar 25 1997 - 00:00:00 CST
![]() |
![]() |