Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChauThan/7482314 to your computer and use it in GitHub Desktop.
Save ChauThan/7482314 to your computer and use it in GitHub Desktop.
How to check record exists before INSERT multiple records
INSERT INTO TargetTable (
id
,email
,NAME
)
SELECT id
,email
,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