Skip to content

Instantly share code, notes, and snippets.

@failpunk
Created July 12, 2014 00:27
Show Gist options
  • Save failpunk/c69ec07e8ca78a3f29ae to your computer and use it in GitHub Desktop.
Save failpunk/c69ec07e8ca78a3f29ae to your computer and use it in GitHub Desktop.
MySQL update from another table
UPDATE sub_campaign
SET sub_campaign.name = (
SELECT targeting_type.name
FROM targeting_type
WHERE targeting_type.id = sub_campaign.targeting_type_id
)
WHERE sub_campaign.name IS NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment