首页/应用软件/内容

学习mysql事件如何调用存储过程的方法

应用软件2023-04-19 阅读()
CREATE EVENT e5 ON SCHEDULE EVERY 1 DAY STARTS '2017-03-01 02:00:00' ON COMPLETION PRESERVE DO BEGIN declare yestday date; set yestday=date(date_add(NOW(), interval -1 day)); if exists(select Id from Stat_VideoHits where AddDate = yestday) THEN delete from Stat_VideoHits where AddDate=yestday; end if;

insert into Stat_VideoHits(Id,VideoId,Times,AddDate) select uuid(), VideoId,COUNT(1),AddDate from Coll_VideoHits where AddDate = yestday group by VideoId;

DELETE from Sum_VideoHits;

insert into Sum_VideoHits(Id,VideoId,Times,UpdateDate) select uuid(),VideoId,sum(Times),now() from Stat_VideoHits group by VideoId;

END (北联网教程,专业提供视频软件下载)

第1页  第2页  第3页 

……

相关阅读