问题
I'm creating a login system for my website, with mysql. It works on a subscription based system. How would I remove all rows with the parameter "premium" equal to "1 DAY", if it's older then a day. I'm trying to run a command like this, in a cron job, that runs once a day. I would duplicate this for rows that have the parameter "premium" = "1 WEEK", etc.
Thanks,
回答1:
It would be something like:
delete t from loginsystem t
where premium = '1 DAY' and created_at < now() - interval 1 day;
来源:https://stackoverflow.com/questions/49086792/mysql-delete-rows-that-contain-a-specific-parameter-and-are-older-then-a-day