mysql - #1064 - 您的 SQL 语法有错误

标签 mysql sql

update publisher_info
set u_code = u_code
where publisher_info.id = unique_code.id;

最佳答案

您缺少第二个表unique_code:

update publisher_info 
set u_code = (SELECT u_code FROM unique_code
              where publisher_info.id = unique_code.id);

或者加入:

update publisher_info 
JOIN unique_code
 ON publisher_info.id = unique_code.id
set publisher_info.u_code = unique_code.u_code 

关于mysql - #1064 - 您的 SQL 语法有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40886788/

相关文章:

php - 从 php 返回 mySQL 错误 - 错误时没有返回任何内容

java - 如何将数据(实际上是Jtable数据)添加到数据库中。有没有办法使用preparedstmt将对象插入数据库?

java - 选择更新之前是一个好方法还是反之亦然?

SQL 架构 : Is this a justified case to have only one table storing multiple entity types?(使用自联接)

python - mysql 的 rdfstore 出现问题 - 如何调试?

PHP 准备的 MySQL UPDATE 语句在字符串中包含变量

mysql - 在 MySQL 中使用 HAVING

python - 列出pyodbc准备语句中的参数

mysql - 为什么 SQL 声明失败?

SQL SELECT 连接?