select id as ids from challenges where expire_date > today
我需要循环她以获取多个 ID,例如(php 中的 foreach)
foreach (ids)
update challenges set status = 'expired' where id = ids
update user_challenge set challenge_status = 'Expired' where challenge_status = 'Pending' and challenge_id = ids
update user_challenge set challenge_status = 'Failed' where challenge_status = 'Accepted' and challenge_id = ids
end for each;
任何人都可以创建存储过程或单个查询来执行此操作,谢谢