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内部连接产品到产品上的产品类别”附近使用”