20 Jun, 2008
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);
Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Other similar 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
Hello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more 

