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

Home -> Community -> Usenet -> c.d.o.server -> Re: Retrieve last N rows

Re: Retrieve last N rows

From: Michael Spellbrink <michaelspellbrink_at_yahoo.de>
Date: 21 May 2002 12:36:04 -0700
Message-ID: <638121fa.0205211136.795220a2@posting.google.com>


hi,

You could try it this way:

select *
from ( <insert your select statement here> order by < insert the column where you want to see the n last values> ) where rownum <= 10

hth, MS

> > Md,
> > You need to define what the last 10 rows of a table means. Tables are sets
> > of data (called tuples in math language) and an unordered set does not have
> > a last. So you need to specify what last means. For example, if you keep
> > track of when a record is inserted you might want the 10 most recently
> > inserted (or last) records. If you don't keep track of when they were
> > inserted then you can't know which ones they are.
> >
> > So you really do have to explain what last means to get the last 10 rows.
>
> Jim,
> We have table that does not contain date column. So normally some 50
> rows are inserted to this table daily. Just I want to see the last 50
> rows.
Received on Tue May 21 2002 - 14:36:04 CDT

Original text of this message

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