Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need some help with ROWNUM
Rather than running it twice, how about running it once with
select * from
(
select * from
((
SELECT columns
FROM tables
WHERE join conditions, including outer join
ORDER BY some columns
)
WHERE ROWNUM < 1026
)
ORDER IT BACKWARDS
)
WHERE ROWNUM < 26
Not sure if I have all the matching parenthesis etc.,
On Mon, 05 Feb 2001 18:02:52 GMT, Gad Krosner <krosner_at_excite.com> wrote:
>Thanks, Steve. I tried that route and it didn't work quite as expected.
>
>For one thing, it didn't return exactly 25 rows. I got either 21 for
>rownum in the range 1001 and 1026, or 27 for rownum between 2001 and
>2026.
>It also seems to run twice as long because these queries run
>independently.
>
>
>In article <t7to4v6mlocv5a_at_corp.supernews.co.uk>,
> "Steve Blomeley" <steveblomeleyATyahoo.co.uk> wrote:
>> Gad,
>>
>> How about ...
>>
>> SELECT * FROM
>> (
>> SELECT columns
>> FROM tables
>> WHERE join conditions, including outer join
>> ORDER BY some columns
>> )
>> WHERE ROWNUM < 1026
>> #
>> MINUS
>> #
>> SELECT * FROM
>> (
>> SELECT columns
>> FROM tables
>> WHERE join conditions, including outer join
>> ORDER BY some columns
>> )
>> WHERE ROWNUM < 1001
>>
>> hth
>> Steve Blomeley
>>
>>
>
>
>Sent via Deja.com
>http://www.deja.com/
Received on Mon Feb 05 2001 - 22:08:58 CST