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
  • 20,857
  • 9
  • 45
  • 61
TomBomb
  • 3,116
  • 5
  • 29
  • 40

2 Answers2

3

Yes, the keyword is IN:

UPDATE Users SET Activated = 1 WHERE ID IN (1, 2, 3, 4,...)
                                        ^^
mellamokb
  • 55,194
  • 12
  • 105
  • 134
0

Just lose the IN_ARRAY string and it will function

Max Hudson
  • 9,698
  • 14
  • 54
  • 103