Update table A set B="abcd" ,C= (case when C="abc" then C="abcd" else C end) where column =1;
means C only Should be changed when column = 1, C value is abc, otherwise C should not be updated.. Should be deleted, only B is changed. But if it is C.
The value is matched, that is, abc gives me output 0… Do not change to abcd
The entire CASE expression should only return one value and then write it to column C, so you only need’abcd’ in this place:
p>
UPDATE tableA
SET B ='abcd',
C = CASE
WHEN C ='abc' THEN'abcd'
ELSE C
END
WHERE column = 1;
I want to update table A, if the attributes of the table column are needed, then only it will change, otherwise it will not change…
Update table A set B="abcd" ,C= (case when C="abc" then C="abcd" else C end) where column = 1;
Means that C should only be changed when column = 1, C value is abc, otherwise C should not be updated.. Should be deleted, only B changes. But if it is C.
The value gets Match, that is, abc gives me output 0.. does not change to abcd
In the THEN part, C = “abcd” compares C with the value, and Return 1 or 0.
The entire CASE expression should only return one value and then write it to column C, so you only need’abcd’ in this place:
< /p>
UP DATE tableA
SET B ='abcd',
C = CASE
WHEN C ='abc' THEN'abcd'
ELSE C
END
WHERE column = 1;