在mysql中创建每日星期日报告

时间:2015-10-11 16:57:40

标签: mysql scheduled-tasks

如何在mysql中创建每日星期日报告? (每个星期天)

我希望我的报告保存在网络磁盘中。有可能吗?

例如:

CREATE EVENT myevent
    ON SCHEDULE EVERY ONE WEEK 
    DO
SELECT titlea,titleb 
FROM tableX
INTO OUTFILE '\\network\Documents\Reports\test.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

1 个答案:

答案 0 :(得分:0)

近...,

您必须指定开始日期

CREATE EVENT `myevent ` 
ON SCHEDULE EVERY 7 DAY STARTS '2015-10-11 02:00:00' 
ON COMPLETION PRESERVE ENABLE DO
BEGIN

SELECT titlea,titleb 
FROM tableX
INTO OUTFILE '\\network\Documents\Reports\test.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

END