27 January 2008
Deleting rows older than 30 days in MySQL
Posted by Mikhail Esteves under: LAMP; Tips .
If you want to delete rows older than xx dates using MySQL, here is a simple way of doing so:
DELETE FROM mytable WHERE date < DATE_SUB(NOW(), INTERVAL 30 DAY);
You could also use INTERVAL 1 MONTH.