From: "Jim Kennedy" <kennedy-family@attbi.com>
Newsgroups: comp.databases.oracle
References: <34343c2e.0206060532.5aa8c704@posting.google.com>
Subject: Re: selecting last n records from the table
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <s2KL8.181783$L76.263373@rwcrnsc53>
NNTP-Posting-Host: 12.224.242.123
X-Complaints-To: abuse@attbi.com
X-Trace: rwcrnsc53 1023372568 12.224.242.123 (Thu, 06 Jun 2002 14:09:28 GMT)
NNTP-Posting-Date: Thu, 06 Jun 2002 14:09:28 GMT
Organization: AT&T Broadband
Date: Thu, 06 Jun 2002 14:09:28 GMT


select * from (select rownum r, * from mytable) where field1<100 and r<10;
Although what the last 10 records mean in a heap is meaningless.  That is if
you don't specify an order then you should not rely on one.
Jim
"marsaroid" <marsaroid@yahoo.co.uk> wrote in message
news:34343c2e.0206060532.5aa8c704@posting.google.com...
> Is there a way to select the last n records from a table in oracle
> based on a criteria. For ex. select * from table where field1 < 100
> and rownum < 10. So out of the returned set of the query i just need
> the last 10 rows of the returned result instead of all.



