I am trying to update two columns in this table. I have the select query working but the update part of is does not.
Here is what I have so far.
UPDATE A
SET foo = 'bar'
car = 'bmw'
FROM TableA A
JOIN TableB B
ON A.col1 = B.colx
AND A.STATUS = B.STATUS
WHERE A.nbr = '1234'
and A.STATUS IN (K,Y)
and A.FILE_TYPE = 'R'
CodePudding user response:
All you need is a WHERE
clause (and the keyword SET
only once):
UPDATE random_table
SET column_1 = 'x',
column_2 = 'y'
WHERE status = 'y';
CodePudding user response:
update random_table
set column_1 = 'x', column_2 = 'y'
from random_Table
where status = 'y'