Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Hod do I select the last 100 records of a Table.

Re: Hod do I select the last 100 records of a Table.

From: Andy Hardy <aph_at_ahardy.demon.co.uk>
Date: Wed, 23 Jun 1999 01:40:48 +0100
Message-ID: <dKRfodAQ0Cc3Ewnu@ahardy.demon.co.uk>


In article <7ko37n$8rq$1_at_nnrp1.deja.com>, shiling_at_math.wayne.edu writes
>Here is an example of selecting last three.
>
>SQL> select * from t;
>
>TDATE
>---------
>09-JAN-99
>09-JAN-98
>09-JAN-97
>09-JAN-96
>09-JAN-95
>09-JAN-94
>
>6 rows selected.
>
>SQL> select * from t
> 2 minus
> 3 select * from t where rownum <= (select count(*)-3 from t);

But what makes it pick the *last* three? Isn't this assuming that the order in which the rows were loaded to the table is the same as the order in which Oracle will retrieve them?

Andy
>
>TDATE
>---------
>09-JAN-94
>09-JAN-95
>09-JAN-96
>
>SQL>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

--
Andy Hardy. PGP key available on request


Received on Tue Jun 22 1999 - 19:40:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US