From: Steve Cholerton <stevechol@freeuk.com>
Newsgroups: comp.databases.oracle.misc
Subject: Re: NEWBIE: Limit Rows Returned by Select ?
Reply-To: stevechol@freeuk.com
Message-ID: <fgl5us4nq8f5s2cn1osktt166aotmtbci8@4ax.com>
References: <fgaptss9ej6ipq414mv2svj87t9dfrguq8@4ax.com> <8rk0t1$cvk1q$1@reader3.wxs.nl> <8of3us8n63l4l4cikh8ftnevrv5d9si3bf@4ax.com> <8ru71g$aat$1@nnrp1.deja.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 60
Date: Tue, 10 Oct 2000 09:43:25 +0100
NNTP-Posting-Host: 212.126.149.87
X-Complaints-To: abuse@freeuk.net
X-Trace: nnrp3.clara.net 971167396 212.126.149.87 (Tue, 10 Oct 2000 09:43:16 BST)
NNTP-Posting-Date: Tue, 10 Oct 2000 09:43:16 BST



Whoops, my mistake, what I meant was the last 2000 records inserted,
which I would like to get at by doing a select on the PK descending
... now I am confused :-)

-S


On Tue, 10 Oct 2000 04:47:45 GMT, Atta ur-Rehman <atta707@my-deja.com>
wrote:

>Hi steve,
>
>well last 2000 rows in the descending order of primary key are the same
>as the first 2000 rows in the ascending order of primary key.
>
>HTH
>
>:) ATTA
>
>In article <8of3us8n63l4l4cikh8ftnevrv5d9si3bf@4ax.com>,
>  stevechol@freeuk.com wrote:
>> Thanks for the response, but I am looking for the LAST 2000 records in
>> the order of the primary key descending, in this case I do not know
>> the rownum (how can I find the last rownum?)
>>
>> -Steve
>>
>> On Fri, 6 Oct 2000 10:01:23 +0200, "Arie Mars" <arie@pca-online.nl>
>> wrote:
>>
>> >select * from system_history
>> >WHERE ROWNUM<=1000
>> >order by primary_key desc
>> >
>> >or use more meaningfull criteria like
>> >WHERE employeenr < 12345   or
>> >WHERE UPPER(CITY)  =  'AMSTERDAM'
>> >or whatever
>> >
>> >Arie Mars
>> >arie@pca-online.nl
>> >
>> >Steve Cholerton <stevechol@freeuk.com> schreef in berichtnieuws
>> >fgaptss9ej6ipq414mv2svj87t9dfrguq8@4ax.com...
>> >> Hi all
>> >> Can anybody advise me if there is a way to limit the number of rows
>> >> returned by a select statement, I have a select statement alsong
 the
>> >> following lines:
>> >>
>> >> select * from system_history order by primary_key desc
>> >>
>> >> I only want the last thousand rows ... is this possible ?
>> >> Many thanx
>> >> -Steve
>> >
>>
>>


