I have this SELECT statement:
SELECT * FROM `all_uu_features`
INNER JOIN `all_video_names`
ON `all_video_names`.`video_id` = `all_uu_features`.`video_id`
WHERE `language` = 'en'
AND `navigation` = 'laser-interface'
I need to reverse this and UPDATE the database. How do I do that? Is there a better way than:
UPDATE `all_uu_features` SET ...
WHERE `language` = 'en'
AND `navigation` = 'laser-interface'
and
UPDATE `all_video_names' SET ...
WHERE video_id = ?
Can this be done with one statement?
all_video_names:
video_id | video_name
-------------------
1 | ABC
2 | DEF
3 ....
all_uu_features:
feature_name | video_id | language | navigation
-----------------------------------------------
Hello 1 | 1 | en | laser-interface
Hello 2 | 2 | fr | laser-interface
There is a multi-table update syntax in MySQL. You can actually find an example in the docs of almost exactly what you’re trying to do.
In your case, it would be: