Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Hod do I select the last 100 records of a Table.
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