Skip to content

Instantly share code, notes, and snippets.

@robinraju
Last active August 2, 2016 09:18
Show Gist options
  • Save robinraju/ec674d081a04c3d0a73b6602b74f41c3 to your computer and use it in GitHub Desktop.
Save robinraju/ec674d081a04c3d0a73b6602b74f41c3 to your computer and use it in GitHub Desktop.
MySQL Upsert | Update row if exists, otherwise perform Insert
INSERT INTO <TABLE>
(<COLUMN 1>, <COLUMN 2>)
VALUES( <VALUE 1>,<VALUE 2>)
ON DUPLICATE KEY UPDATE
`<COLUMN1>` = '<VALUE1>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment