Skip to content

Instantly share code, notes, and snippets.

@beck03076
Created December 13, 2014 20:53
Show Gist options
  • Save beck03076/87ec1380931cdfe54f22 to your computer and use it in GitHub Desktop.
Save beck03076/87ec1380931cdfe54f22 to your computer and use it in GitHub Desktop.
# migrate branch names --
INSERT INTO branches(name)
SELECT DISCTINCT(BranchName)
FROM 527433_iec.iec_branch;
# map country ids --
UPDATE branches b
INNER JOIN 527433_iec.iec_branch ob
ON ob.BranchName = b.name
INNER JOIN 527433_iec.iec_country oc
ON ob.country = oc.CountryId
INNER JOIN countries c
ON oc.CountryName = c.name
SET b.country_id = c.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment