Reputation: 3296
I know I've seen this syntax before, but I can't remember it/find it on here.
I want to write the condensed form of the following query:
UPDATE Users SET Activated = 1 WHERE ID = 1 OR ID = 2 OR ID = 3 OR ID = 4 OR...
There is a way to have the WHERE
attribute be a set of values, something like:
UPDATE Users SET Activated = 1 WHERE ID IN_ARRAY(1, 2, 3, 4, ...)
Can anyone tell me the exact syntax?
Thank you!!
Upvotes: 1
Views: 680
Reputation: 56769
Yes, the keyword is IN
:
UPDATE Users SET Activated = 1 WHERE ID IN (1, 2, 3, 4,...)
^^
Upvotes: 3