Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> getting multiple Newest records
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
![]() |
![]() |