MySQL Forums
Forum List  »  Newbie

How do I delete all but most recent record?
Posted by: dump3
Date: July 25, 2005 08:36AM

I've been struggling with a problem trying to purge out a huge log table. Each record has many fields, but I want to delete all but the most recent entry based on the name field, ip_address field, and date field (containing unixtime).

Specifically, I want to do something like:

DELETE from log_table where name AND ip_address are unique except for where date is the largest value

Keeping in mind multiple names can use the same ip_address.

I'd greatly appreciate any help. :)

Options: ReplyQuote


Subject
Written By
Posted
How do I delete all but most recent record?
July 25, 2005 08:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.