aHMAD_SQaLli Posted December 4, 2015 Share Posted December 4, 2015 Hello I want to make a SQL row to be deleted after one day, or week, or every row older than on week automatically, how can it be done ? Have a good day. Quote Link to comment Share on other sites More sharing options...
Barand Posted December 4, 2015 Share Posted December 4, 2015 Assuming your table has a date column DELETE FROM tablename WHERE date_col < CURDATE() - INTERVAL 7 DAY Quote Link to comment Share on other sites More sharing options...
aHMAD_SQaLli Posted December 4, 2015 Author Share Posted December 4, 2015 Thanks, that was helpful, but I should run this manually, is there any way to be 100% auto . Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted December 4, 2015 Solution Share Posted December 4, 2015 You would use Windows Scheduler or a cron job (linux) to invoke the query. 1 Quote Link to comment Share on other sites More sharing options...
aHMAD_SQaLli Posted December 4, 2015 Author Share Posted December 4, 2015 Thank you very much ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.