Z33M@N Posted August 27, 2009 Share Posted August 27, 2009 I need to know how to check if dates are older than 2 weeks. Then needs to delete rows older than 2 weeks. Link to comment https://forums.phpfreaks.com/topic/172106-mysql-help-checking-if-dates-are-older-than-2-week-then-delete-the-rows/ Share on other sites More sharing options...
TeNDoLLA Posted August 27, 2009 Share Posted August 27, 2009 CAUTION: I have not tested this and I will not quarantee it will work for sure so I sugges you TAKE BACKUP before running it. But something like this should do it (assuming your date_field is DATETIME format): DELETE FROM some_table WHERE date_field < DATE_SUB(NOW(), INTERVAL 14 DAY); Link to comment https://forums.phpfreaks.com/topic/172106-mysql-help-checking-if-dates-are-older-than-2-week-then-delete-the-rows/#findComment-907741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.