【问题标题】:Mysql multi query getting err #1064 -Mysql 多查询出错 #1064 -
【发布时间】:2017-01-07 21:48:29
【问题描述】:

需要帮助

当我运行这个查询时,我得到了一个错误 Just simple update query 如果正在一个一个地运行,它可以正常工作。

update wp_posts 
set post_title = CONCAT(post_title,' Keyboard') 
where id = 67096 and NOT post_title like '%keyboard%'

update wp_posts 
set post_title = CONCAT(post_title,' Keyboard') 
where id = 67079 and NOT post_title like '%keyboard%'

update wp_posts 
set post_title = CONCAT(post_title,' Keyboard') 
where id = 67072 and NOT post_title like '%keyboard%'

我收到了这个错误消息

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 2 行的 'update wp_posts set post_title = CONCAT(post_title,' Keyboard') where id = 67131' 附近使用正确的语法

重要的是,当我一行一行地运行查询时,它可以完美运行!如果我逐行运行它们,查询将失败

请帮助我理解问题

感谢阿萨夫

【问题讨论】:

  • 在每个更新语句的末尾添加;

标签: mysql


【解决方案1】:

如果同时运行多个sql queries,则在每个sql查询后添加分号(;)否则会报错。

立即尝试。

update wp_posts set post_title = CONCAT(post_title,' Keyboard') where id = 67096 and NOT post_title like '%keyboard%';
update wp_posts set post_title = CONCAT(post_title,' Keyboard') where id = 67079 and NOT post_title like '%keyboard%';
update wp_posts set post_title = CONCAT(post_title,' Keyboard') where id = 67072 and NOT post_title like '%keyboard%';

希望它会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-18
    • 1970-01-01
    • 1970-01-01
    • 2020-06-24
    • 1970-01-01
    • 2019-05-06
    • 2018-04-14
    • 2015-04-07
    相关资源
    最近更新 更多