Skip to content

Commit 3a24ae3

Browse files
Callum GibbonsCallum Gibbons
authored andcommitted
[SQL-466] - Update Multiple Rows With Different Values With Single Query
1 parent cc2d819 commit 3a24ae3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPDATE users SET user_type = 'ADULT' WHERE age >= 18;
2+
UPDATE users SET user_type = 'JUNIOR' WHERE age < 18;
3+
4+
UPDATE users SET user_type =
5+
(CASE
6+
WHEN age >= 18 THEN 'ADULT'
7+
WHEN age < 18 THEN 'JUNIOR'
8+
END);

0 commit comments

Comments
 (0)