Skip to content

Instantly share code, notes, and snippets.

@bjdixon
Created March 30, 2017 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjdixon/d0a7bb4f04cea099df6d99c362956f4f to your computer and use it in GitHub Desktop.
Save bjdixon/d0a7bb4f04cea099df6d99c362956f4f to your computer and use it in GitHub Desktop.
Insert a record, if the pk already exists then update the record
INSERT IN tablename (id, val1, val2) VALUES (1, 'a', 'b')
ON DUPLICATE KEY UPDATE val1 = 'a', val2 = 'b';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment