Created
January 11, 2018 12:33
-
-
Save kauhat/3c8e7eb2014b506b5e3c9cce39210400 to your computer and use it in GitHub Desktop.
Using a CASE/WHEN/THEN/ELSE statement within an UPDATE query.
This file contains 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
UPDATE `organisations` | |
SET `description` = CASE id | |
WHEN 1 THEN 'something' | |
WHEN 2 THEN 'something else' | |
WHEN 3 THEN 'we\'re on the third record still' | |
WHEN 5 THEN 'we\'ve jumped to record five' | |
WHEN 6 THEN '...' | |
ELSE NULL | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment