业务需要,超过5天的清除订单表和用户表状态,定时每晚3点执行
UPDATE shop_store_apply set is_delete=2 where id in (select id from
(select max(id) as id from shop_store_apply where user_id in
(select id from t_user where id in
(select user_id from shop_store_apply where DATE_ADD(modify_date,interval 5 day)<now() and type=21 and status=2 and is_delete=1)
and trade_amount<1)
and type=21 and is_delete=1 and status=2 GROUP BY user_id) as tmp)