I am trying to update a column with a calculated column in a inner join. The logic is simple but I am struggling with the syntax (this is just a dummy SQL, to explain what I am trying to accomplish - it does not run)
UPDATE t1
SET t1.BodyText = t2.final
from Questions as t1
INNER JOIN translations as t2
on t2.QuestionId=t1.QuestionID
CONCAT(t1.BodyText,t2.QuestionBodyText) as final
The task is simple, concat a question with its translation. I found some questions related to this issue on stackoverflow, but they where no help, maybe because they were discussing SQL Server.
Similar: Update a table using JOIN in SQL Server?
I tried that:
UPDATE Questions t1
JOIN translations t2
on t1.QuestionID=t2.QuestionId
SET t1.BodyText = CONCAT(t1.BodyText,t2.QuestionBodyText)
But it does not have any effect on the database.
This is an equivalent SELECT that works:
SELECT CONCAT(t1.BodyText,t2.QuestionBodyText) FROM Questions t1
JOIN translations t2
on t1.QuestionID=t2.QuestionId
Update, when I used this update query on phpmyadmin it worked, on workbench it did not..