Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您好我正在尝试创建一个查询,以删除所有记录为 2012/11/10 之前 30 天的数据。我不知道该怎么做,因为我能想到的就是
DELETE FROM fines WHERE fTime < (2012-11-10, INTERVAL 30 DAY)
但是,这给了我错误 1292 不正确的日期值
谁能指出我正确的方向?
尝试
DELETE FROM fines WHERE fTime < ('2012-11-10' - INTERVAL 30 DAY)
http://sqlfiddle.com/#!2/d41d8/4099
尝试这个:
delete from fines where ftime < DATE_SUB("2012-11-10" , INTERVAL 30 DAY)
http://sqlfiddle.com/#!2/d41d8/4100