[英]Update table from joining multiple tables in MYSQL
Hi I would like to update my table but its giving me an error. 嗨,我想更新我的表,但它给我一个错误。
ERROR 1064 (42000): You have an error in your SQL syntax;
This is my script 这是我的剧本
UPDATE table1
SET last_name = table3.lastname,
first_name = table3.firstname,
FROM table1
INNER JOIN table2
ON table2.entity_id = table1.entity_id
INNER JOIN table3
ON table3.biometric_id = table2.biometric_id;
This should work given you're using MySql
-- UPDATE... JOIN... SET...
: 鉴于您使用的是
MySql
这应该可以正常工作UPDATE... JOIN... SET...
:
UPDATE table1 t1
JOIN table2 t2
ON t2.entity_id = t1.entity_id
JOIN table3 t3
ON t3.biometric_id = t2.biometric_id;
SET t1.last_name = t3.lastname,
t1.first_name = t3.firstname
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.