20 Jun, 2008
Delete rows older than x days or x months in MySQL
Web Development » PHP, Snippets » Delete rows older than x days or x months in MySQL
DELETE FROM `tablename` WHERE `created` < DATE_SUB(NOW(), INTERVAL 5 DAY);
DELETE FROM `tablename` WHERE `created` < DATE_SUB(NOW(), INTERVAL 1 MONTH);
Other similiar posts that you might be interested in:
- jQuery Calendar Widget Plugin
- Convert to sentence case in MySQL
- 15 tips on optimising MySQL databases and MySQL queries
- How old is your domain?
- WordPress iPhone App – a step by step user guide to using WordPress for iPhone
- Troubleshooting an IFrame Injection Attack
- Remove the first character in mysql






