I have a list of values(deviceID) and I need to make an MySQL Query to update a column value, I can do the query in the following way
UPDATE Clients.Devices
SET assignedUserID='Jhon'
WHERE accountID='Delivery1' AND
(deviceID='1234' OR deviceID='1235' OR deviceID='1236')
That’s is a simple example but some accountID have more than 500 devicesID so I’m looking for a shorter SQL statement
So, There’s any way to pass the list of deviceID’s to the SQL server?
Something like
UPDATE Clients.Devices
SET assignedUserID='Jhon'
WHERE accountID='Delivery1' AND
(deviceID=('1234','1235','1236))
Thanks.
UPDATE
if the datatype of
deviceIDis numberic, single quotes are not required.maybe
INfor multiple values not=or if the ID are in sequence use
BETWEEN