DROP EVENT IF EXISTS `event_cuxiaogoods`; DELIMITER ;; CREATE DEFINER=`root`@`localhost` EVENT `event_cuxiaogoods` ON SCHEDULE EVERY 1 MINUTE STARTS '2016-01-17 14:49:43' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN update yc_goods set isSale =0 where goodsId in (select goodsId from(select goodsId from yc_goods where datediff(now(),date_add(fabutime, interval huodongtime day))=0 ) a); END ;; DELIMITER ;