MySQL Forums
Forum List  »  Newbie

Re: How do I delete all but most recent record?
Posted by: Roland Bouman
Date: July 26, 2005 06:11AM

maybe:

delete
from log_table all_entries
where date_field < (
select max(date_field)
from log_table last_entry
where all_entries.name = last_entry.name
and all_entries.ip_address = last_entry.ip_address
)

Options: ReplyQuote


Subject
Written By
Posted
Re: How do I delete all but most recent record?
July 26, 2005 06:11AM


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.