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: Newbie question: get last record of a series

Re: Newbie question: get last record of a series

From: Gorm Larsen <gorm_larsen_at_jyde.dk>
Date: Wed, 21 Apr 1999 22:37:08 +0200
Message-ID: <MPG.1188555e64c0ffac989718@1RELAX.DK>


In article <371E0F8B.1CDBA0FD_at_mci.com>, bob.mcconnell_at_mci.com says...
> I have a table like this:
> field1 field2 field3 date_field
> ABCD 0 0 1 apr 99
> ABCD 0 0 2 apr 99
> ABCD 0 1 1 apr 99
> ABCD 1 1 2 apr 99
> ABCD 1 1 3 apr 99
>
> I need to return in this case rows 2,3 and 5
> the latest date for the unique combinations of field1,2 and 3

Newbie answer:
select field1, field2, field3, max(date_field) from table group by field1, field2, field3;

HTH --
Gorm Larsen
Hjælp til XAL og AxApta? Abonner på news.tadorna.dk Received on Wed Apr 21 1999 - 15:37:08 CDT

Original text of this message

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