Skip to content

Instantly share code, notes, and snippets.

@jfreites
Created April 28, 2014 00:00
Show Gist options
  • Save jfreites/11358507 to your computer and use it in GitHub Desktop.
Save jfreites/11358507 to your computer and use it in GitHub Desktop.
Update value based on subquery
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