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 -> getting multiple Newest records

getting multiple Newest records

From: Steve Wicklund <savant_7_at_hotmail.com>
Date: 28 Jan 2003 14:34:26 -0800
Message-ID: <5de96e4e.0301281434.2fb70c1f@posting.google.com>


Hello all;

 Given a table where there are columns id (varchar), description (varchar), and date (date), where none of the columns are unique; I am trying to select the 'newest' row (as determined by date col) of each id. That is for each unique ID, the row that has the newest date value. I would like all three columns in the result. I am capable of getting single the newest record, but not the newest for each id.

rowId id description date


row1     01    yada        01-10
row2     02    yada2       01-10
row3     01    newYada     01-12
row4     02    yada3       01-20
row5     03    yadayada    02-20
row5     04    yada5       02-01

In this case rownums 3,4,5,6 would get returned. Rows 1,2 ignored because older than the max date for that id. Can't seem to figure how to get the multiple 'max's' from data col. Received on Tue Jan 28 2003 - 16:34:26 CST

Original text of this message

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