2016-08-22 85 views
0

還是MySQL的新手。我的語法在哪裏出錯?MYSQL錯誤1064:創建事件

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE 
DO 
BEGIN 
INSERT INTO table_1 (column_name) SELECT column FROM table_1 WHERE column REGEXP 'regex_string' 
END; 

回答

0

刪除BEGINEND,因爲它不是一個複合語句並且如果您的列名是column然後逃逸它像

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE 
DO 
INSERT INTO table_1 (column_name) 
    SELECT `column` FROM table_1 
    WHERE `column` REGEXP 'regex_string'; 

參考MySQL Documentation

+0

也做到了。謝謝您的幫助。 –