【发布时间】:2019-09-26 22:19:00
【问题描述】:
我正在尝试从表 A 中选择两个表来替换表 B 中的值的属性。 对我来说重要的是表格没有更新。
table_A
id category_id filename
1 2 apple
2 12 banana
3 453 pineapple
table_B
id category_color category_type
2 red fruit
12 yellow fruit
453 brown fruit
MYSQL 版本是 mysql Ver 14.14 Distrib 5.5.62,适用于使用 readline 6.3 的 debian-linux-gnu (x86_64)
mysql> SELECT * FROM table_A INNER JOIN table_B ON table_A.category_id = table_B.id SET table_A.category_id = category_name;
ERROR 1064 (42000): 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 'SET table_A.category_id = category_name' at line 1
输出应该像下面的例子
输出
id category_id filename
1 red apple
2 yellow banana
3 brown pineapple
【问题讨论】:
-
SET是干什么用的???你是SELECTing 记录。
标签: mysql sql database join select