Created
November 15, 2013 10:31
-
-
Save ChauThan/7482314 to your computer and use it in GitHub Desktop.
How to check record exists before INSERT multiple records
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
INSERT INTO TargetTable ( | |
id | |
,NAME | |
) | |
SELECT id | |
,NAME | |
FROM SourceTable AS S | |
WHERE NOT EXISTS ( | |
SELECT * | |
FROM TargetTable AS T | |
WHERE T.email = S.email | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment