如何创建自动执行此查询的日常触发器?
insert into deliverability.test_month (type,from_sale)
select type,from_sale
from deliverability.delivery_money_repo
where total = 100
最佳答案
使用其中的代码创建一个存储过程并按如下方式调用它
CREATE PROCEDURE Daily_Insertion
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
insert into deliverability.test_month (type,from_sale)
select type,from_sale
from deliverability.delivery_money_repo
where total = 100
END
然后将其设置为每天运行
CREATE EVENT myevent
ON SCHEDULE EVERY 1 DAY
DO
CALL Daily_Insertion
关于mysql - 创建日常触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42385138/