Perhaps you can achieve this with self-connect, and IS NOT NULL.
Joining DELETE queries can be a little dangerous, because the more complex, the greater the risk of deleting more than you intend in some cases.
But I would approach him like that.
DELETE a.* FROM mytable AS a LEFT JOIN mytable AS b ON b.date > a.date AND (b.name=a.name OR (b.date = a.date AND b.rowid>a.rowid)) WHERE AND b.rowid IS NOT NULL
The connection and IS NOT NULL detect every row for which there is a newer row with the same name. It also correctly handles the case of two rows with the same date - if they have the same date, then it follows rowid (no matter what it is).
Hope something like this works.
source share