Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Remove all rows but most recent of each

DirdSep 11 2009 — edited Sep 11 2009
Hi,

I have a table with around 3.6 million rows and came up with an idea of how to improve the speed of a query. Basically my idea was to make a query which removed (ultimately to go into a history table) all records related to a particular area except for the 2 most recent as these are the only ones used. For example:


SPORT      ||    PLAYER    ||    DATE
========================
FOOTBALL     RONALDO      08-JUL-09
FOOTBALL     RONALDO      11-JUN-09
FOOTBALL     RONALDO      22-MAR-09
MMA              FEDOR           10-SEP-09
MMA              FEDOR           15-AUG-09
MMA              FEDOR           11-AUG-09

The idea is that the last ronaldo & fedor records would be deleted somehow...All the things I've tried so far have been a disaster =)
Thanks for any help.

Mike
This post has been answered by Sven W. on Sep 11 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2009
Added on Sep 11 2009
8 comments
685 views