Reputation: 1139
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;
Upvotes: 0
Views: 50
Reputation: 62831
This should work given you're using 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
Upvotes: 1