Similar to this question : SQL Statement with multiple SETs and WHEREs
Is there a way to perform multiple sets, as shown below.
UPDATE table
SET ID = 111111259
SET Name = "Bob"
SET Phone = 1111111261
WHERE ID = 2555
Thanks.
Similar to this question : SQL Statement with multiple SETs and WHEREs
Is there a way to perform multiple sets, as shown below.
UPDATE table
SET ID = 111111259
SET Name = "Bob"
SET Phone = 1111111261
WHERE ID = 2555
Thanks.
This is possible,
UPDATE table SET Name = 'aaa', Col2 = 'bbb' WHERE ID IN (2555, 2666)
What you are asking for is setting multiple values to same column and same row.
No need of SET
for each column. do it like
UPDATE table
SET ID = 111111259,
Name = 'Bob',
Phone = 1111111261
WHERE ID = 2555
No. There is no way to do what your query suggests. You are trying to set the same column, ID, to three different values. What is sql supposed to do in this case? You can set multiple columns in the same update statement, but you can't set the same column to three different values.
To update multiple columns, use a comma.
UPDATE table
SET ID = 111111259,
Name = 'Bob',
Phone = 1111111261
WHERE ID = 2555