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 -> How do I get the most recent entries when ...

How do I get the most recent entries when ...

From: D. Alvarado <laredotornado_at_zipmail.com>
Date: 5 Feb 2002 13:04:46 -0800
Message-ID: <9fe1f2ad.0202051304.60f1ac2d@posting.google.com>


I have a table like this:

ID FIELD1 FIELD2 DATE_ENTERED

--  ------ ------ ------------
1   xxx    xxx    01-JAN-1997
2   xxx    xxx    05-JAN-1998
1   xxx    xxx    05-NOV-2001
2   xxx    xxx    14-MAR-1999
1   xxx    xxx    15-JAN-1996

Assuming all DATE_ENTERED fields are unique (it is the primary key), how could I formulate a PL-SQL query that only selects the most recent entries per "ID" field. So, in this prmitive example, I'd want the query to return rows 3 and 4 because row 3 is the most recent entry for ID "1" and 4 is the most recent entry for ID "2".

I'm using Oracle 8.1.7, if that matters.

Thanks in advance, Dave A. Received on Tue Feb 05 2002 - 15:04:46 CST

Original text of this message

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