Skip to content

Instantly share code, notes, and snippets.

@jianhu
Last active December 17, 2015 03:48
Show Gist options
  • Save jianhu/5545770 to your computer and use it in GitHub Desktop.
Save jianhu/5545770 to your computer and use it in GitHub Desktop.
UPDATE table SET field='C', field2='Z' WHERE id=3;
INSERT INTO table (id, field, field2)
SELECT 3, 'C', 'Z'
WHERE NOT EXISTS (SELECT 1 FROM table WHERE id=3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment