Delete Range of dates in MySQL
Posted on 2014-01-06
I have searched the internet and copied in at least 7 solutions that are advertised around, but I simply cannot get it to work.
Problem: I have 100,000 rows in a database - all with a date field populated. I want to delete all rows if the date is older than 14 days. Among many attempts, this was my last, but the SQL is bad. Any thoughts for a legit solution that actually works :)
DELETE * FROM hours WHERE ADJAPPLYDTM < DATE_SUB( 2013-12-30, INTERVAL 14 DAY )
I would paste all the others I tried, but it wouldn't do any good at this point since they didn't work and I don't remember them.