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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Retrieving first occurrence - How?

Re: Retrieving first occurrence - How?

From: Walter T Rejuney <BlueSax_at_Unforgetable.com>
Date: Wed, 16 Aug 2000 13:38:44 -0400
Message-ID: <399AD1A4.3A1A883D@Unforgetable.com>

GF wrote:
>
> Thanks! That looks promising. It works in all of the tests I've run.
> Can anyone verify that max(rowid) will always return the last record
> entered for multiple entries in a table?
>
> In article <966436810.9910.0.nnrp-13.9e9809ca_at_news.demon.co.uk>,
> "Richard Armstrong" <richard.armstrong_at_juno.demon.co.uk> wrote:
> > Could you use the rowid? This could allow you to select a single
 record but
> > I'm not certain whether max(rowid) would always necessarily
 correspond to
> > the most recently added record.
> >
> > Regards,
> >
> > Richard
> >
> > GF <GAYLEN.FRALEY_at_MAIL.SPRINT.COM> wrote in message
> > news:8ne5b4$mim$1_at_nnrp1.deja.com...
> > > Assume that table A has multiple records for a given id. Is there a
> > > way to select only one (or the first) occurrence of each id?
 There is
> > > no other field to group by/having. I just always want the last
 record
> > > that was added. There is no timestamp field.

You might get lucky and have it work most of the time, but it isn't reliable if you have a partitioned table, if rows are ever deleted or a host of other possibilities. Received on Wed Aug 16 2000 - 12:38:44 CDT

Original text of this message

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