Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 从两个内部联接更新_Mysql_Sql_Sql Update_Inner Join - Fatal编程技术网

Mysql 从两个内部联接更新

Mysql 从两个内部联接更新,mysql,sql,sql-update,inner-join,Mysql,Sql,Sql Update,Inner Join,我想从几个内部联接更新表INVENTAR中的一列。 我有以下几点: 带有列产品ID,类别的表发明人 带有列产品ID,类别ID 表CATEGORY\u DESCRIPTION,包含CATEGORY\u ID,NAME 我希望名称列更新类别列。 这是我的密码: UPDATE inventar SET inventar.category=category_description.name FROM inventar INNER JOIN product_to_category

我想从几个内部联接更新表
INVENTAR
中的一列。 我有以下几点:
带有列
产品ID
类别的表
发明人

带有列
产品ID
类别ID

CATEGORY\u DESCRIPTION
,包含
CATEGORY\u ID
NAME

我希望
名称
列更新
类别
列。 这是我的密码:

UPDATE inventar
   SET inventar.category=category_description.name
  FROM inventar
       INNER JOIN product_to_category 
             ON product_to_category.product_id=inventar.product_id
       INNER JOIN category_description 
             ON category_description.category_id=product_to_category.category_id

正确的MySQL语法是:

UPDATE inventar i INNER JOIN
       product_to_category ptc
       ON ptc.product_id = i.product_id INNER JOIN
       category_description cd
       ON cd.category_id = ptc.category_id
   SET i.category = cd.name;

您的语法看起来更适合SQL Server或Postgres。

正确的MySQL语法是:

UPDATE inventar i INNER JOIN
       product_to_category ptc
       ON ptc.product_id = i.product_id INNER JOIN
       category_description cd
       ON cd.category_id = ptc.category_id
   SET i.category = cd.name;

您的语法看起来更适合SQL Server或Postgres。

正确的MySQL语法是:

UPDATE inventar i INNER JOIN
       product_to_category ptc
       ON ptc.product_id = i.product_id INNER JOIN
       category_description cd
       ON cd.category_id = ptc.category_id
   SET i.category = cd.name;

您的语法看起来更适合SQL Server或Postgres。

正确的MySQL语法是:

UPDATE inventar i INNER JOIN
       product_to_category ptc
       ON ptc.product_id = i.product_id INNER JOIN
       category_description cd
       ON cd.category_id = ptc.category_id
   SET i.category = cd.name;

您的语法看起来更适合SQL Server或Postgres。

您有什么问题吗?嗯,它不起作用。。所以我希望有人能重新格式化代码。我得到了这个错误:“#1064-您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,在第3行“从inventar Internal JOIN product_到product_t上的_category”附近使用正确的语法”您有什么问题吗?嗯,它不起作用。。所以我希望有人能重新格式化代码。我得到了这个错误:“#1064-您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,在第3行“从inventar Internal JOIN product_到product_t上的_category”附近使用正确的语法”您有什么问题吗?嗯,它不起作用。。所以我希望有人能重新格式化代码。我得到了这个错误:“#1064-您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,在第3行“从inventar Internal JOIN product_到product_t上的_category”附近使用正确的语法”您有什么问题吗?嗯,它不起作用。。所以我希望有人能重新格式化代码。我得到了这个错误:“#1064-您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以获得正确的语法,以便在第3行的“从inventar内部连接产品到产品上的产品类别”附近使用”