Skip to content

Instantly share code, notes, and snippets.

@tux255
Created February 13, 2017 09:05
Show Gist options
  • Save tux255/250f7d9cdfc1c3a595473d196cb60ee1 to your computer and use it in GitHub Desktop.
Save tux255/250f7d9cdfc1c3a595473d196cb60ee1 to your computer and use it in GitHub Desktop.
SQL update if exists
INSERT INTO <table> (field1, field2, field3, ...)
VALUES ('value1', 'value2','value3', ...)
ON DUPLICATE KEY UPDATE
field1='value1', field2='value2', field3='value3', ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment