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: latest date

Re: latest date

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 24 May 2001 21:17:40 -0400
Message-ID: <2kcrgts5hbnub5ot4qo71jtkkv36ohpv7f@4ax.com>

A copy of this was sent to wellsv_at_mail.modot.state.mo.us (Vicki) (if that email address didn't require changing) On 24 May 2001 12:26:31 -0700, you wrote:

>I need a way to filter out the latest date for records that have more
>than one entry. I have vehicle numbers with entries in a another field
>with the date of inspection. How can I get just the latest date?

select *
  from t
 where date_field = ( select max(date_field)

                        from t t2
                       where t2.primary_key_field = t.primary_key_field )
/

will do it.

--
Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://asktom.oracle.com/ http://asktom.oracle.com/~tkyte/
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Thu May 24 2001 - 20:17:40 CDT

Original text of this message

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