Last active
December 13, 2015 17:48
-
-
Save tjsingleton/4950326 to your computer and use it in GitHub Desktop.
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
CREATE TABLE report ( | |
account_id INT UNIQUE, | |
classification VARCHAR(11) | |
); | |
CREATE TABLE report_temp ( | |
account_id INT UNIQUE, | |
classification VARCHAR(11) | |
); | |
INSERT INTO report (account_id, classification) VALUES (1, "report"); | |
INSERT INTO report (account_id, classification) VALUES (2, "report"); | |
INSERT INTO report (account_id, classification) VALUES (3, "report"); | |
INSERT INTO report (account_id, classification) VALUES (4, "report"); | |
INSERT INTO report (account_id, classification) VALUES (5, "report"); | |
INSERT INTO report (account_id, classification) VALUES (6, "report"); | |
INSERT INTO report (account_id, classification) VALUES (7, "report"); | |
INSERT INTO report (account_id, classification) VALUES (8, "report"); | |
INSERT INTO report (account_id, classification) VALUES (9, "report"); | |
INSERT INTO report (account_id, classification) VALUES (10, "report"); | |
INSERT INTO report_temp (account_id, classification) VALUES (1, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (3, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (5, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (7, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (9, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (11, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (12, "report_temp"); | |
INSERT INTO report_temp (account_id, classification) VALUES (13, "report_temp"); | |
REPLACE INTO report_temp | |
SELECT report.* FROM report | |
INNER JOIN report_temp | |
WHERE report.account_id = report_temp.account_id; |
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
account_id | classification | |
---|---|---|
1 | report | |
3 | report | |
5 | report | |
7 | report | |
9 | report | |
11 | report_temp | |
12 | report_temp | |
13 | report_temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment