gpt4 book ai didi

mysql - 错误 1064 (42000) : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax

转载 作者:行者123 更新时间:2023-11-29 18:17:28 26 4
gpt4 key购买 nike

我尝试在 mysql 版本 5.7.19 中执行查询 View 时遇到错误

这是我的查询:

CREATE ALGORITHM=UNDEFINED DEFINER=`acc_webdev`@`%` SQL SECURITY DEFINER VIEW `view_dash_total` AS 
SELECT
COUNT(0) AS `jumlah`,
SYSDATE() AS `tanggal`
FROM `table_laporan`
WHERE (STR_TO_DATE(`table_laporan`.`dt_added`,'%d-%m-%Y') < (SYSDATE() + INTERVAL - (1)DAY))$$

并收到此错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$$' at line 6

但是在mysql 5.1.25中,当我执行上面的查询时没有错误

请帮帮我

最佳答案

在 DDL 前面添加 DELIMITER $$ 或将分隔符更改为 ;

了解更多关于delimiters here的信息

关于mysql - 错误 1064 (42000) : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46902188/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com