gpt4 book ai didi

运行查询时出现mysql错误

转载 作者:行者123 更新时间:2023-11-30 22:35:58 26 4
gpt4 key购买 nike

这是我在 mysql 中的查询(我使用 phpmyadmin 来执行查询)。但我无法执行....可以帮帮我吗?

SELECT count(*) into @cnt FROM `oie_option` WHERE `opt_name` =CONCAT('earning1391',pmonth('2015-09-09')))
if(@cnt <=0)then
INSERT INTO oie_option ('opt_name','opt_value') VALUES (CONCAT('earning1391',pmonth('2015-09-09')),1000);
end if;

这是错误:

1064 - 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 ')

if(@cnt <=0)then insert into oie_option ('opt_name','opt_value') values(CON' at line 1

为什么?谢谢

最佳答案

我认为您在第一个查询中缺少分号。

    SELECT count(*) into @cnt FROM `oie_option`
WHERE `opt_name` =CONCAT('earning1391',pmonth('2015-09-09'));
if(@cnt <=0)then
INSERT INTO oie_option ('opt_name','opt_value') VALUES
(CONCAT('earning1391',pmonth('2015-09-09')),1000);
end if;

关于运行查询时出现mysql错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32559154/

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