Created
January 21, 2017 11:50
-
-
Save MathRobin/751eff46594ed258d4783bc6680d3308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH upsert AS | |
(UPDATE maTable | |
SET monChamp = 'nouvelleValeur'; | |
WHERE monId = cetId | |
RETURNING *) | |
INSERT INTO maTable | |
(monId, monChamp) | |
SELECT cetId, 'nouvelleValeur' | |
WHERE NOT EXISTS (SELECT * FROM upsert); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment