Reputation: 173
Hello I am trying to create a query that deletes all data that is recorded as being before 2012/11/10 by 30 days. I am not sure how to do this as all I can think of is
DELETE FROM fines
WHERE
fTime < (2012-11-10, INTERVAL 30 DAY)
However this gives me error 1292 incorrect date value
Can anyone point me in the right direction?
Upvotes: 2
Views: 3697
Reputation: 474
Try this:
delete from fines where ftime < DATE_SUB("2012-11-10" , INTERVAL 30 DAY)
http://sqlfiddle.com/#!2/d41d8/4100
Upvotes: 3
Reputation: 27287
try
DELETE FROM fines
WHERE
fTime < ('2012-11-10' - INTERVAL 30 DAY)
http://sqlfiddle.com/#!2/d41d8/4099
Upvotes: 3