I have tried a solution that seems to work for someone else on this question:
Update table a from table b where (conditions) I can not seem to get it working, MySql gives me a syntax error.
I have two tables, and I need to update a column in one table to the value of another column where an id matches in both tables.
UPDATE video_data SET video_data.date_timestamp = video.date_timestamp FROM video_data JOIN video ON video_data.video_id = video.video_id
I am not sure what the issue is with my syntax. I am quite tired and maybe it is just my eyes playing with me. Thanks for the help!
In this article, we will see, how to update from one table to another table based on ID match. We can update the table using UPDATE statement in SQL. The update statement is always followed by the SET command. The SET command is used to specify which columns and values need to be updated in a table.
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.
Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record(s) that should be updated. If you omit the WHERE clause, all records in the table will be updated!
Try this syntax out:
UPDATE video_data, video
SET video_data.date_timestamp = video.date_timestamp
WHERE video_data.video_id = video.video_id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With