1

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!!

Colin Brock
  • 21,267
  • 9
  • 46
  • 61
TomBomb
  • 3,236
  • 5
  • 31
  • 40

2 Answers2

3

Yes, the keyword is IN:

UPDATE Users SET Activated = 1 WHERE ID IN (1, 2, 3, 4,...)
                                        ^^
mellamokb
  • 56,094
  • 12
  • 110
  • 136
0

Just lose the IN_ARRAY string and it will function

Max Hudson
  • 9,961
  • 14
  • 57
  • 107