Created
April 28, 2014 00:00
-
-
Save jfreites/11358507 to your computer and use it in GitHub Desktop.
Update value based on subquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE target_table t | |
INNER JOIN ( | |
select value1, value2 | |
from another_table | |
) x | |
ON t.field_a = x.value2 | |
SET t.field_b = x.value1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment