Hello, I have a problem with understanding case statement. I want to set particular salary values for certain groups of employeeids (for example: when emploeeid is in (2,3,4) then i want their salary to be 200). Table: emp1, Columns: employeeid, salary
The code that works looks like that:
update emp1
set salary =
case
when employeeid in (2,3,4) then 200
when employeeid in (5,6,7) then 1200
when employeeid in (8,9,10)then 3200
else 6000
end;
but why is it like that and not like (for example) that:
case
when employeeid in (2,3,4) then update emp1 set salary = 200
when employeeid in (5,6,7) then update emp1 set salary = 1200
when employeeid in (8,9,10)then update emp1 set salary = 3200
else update emp1 set salary = 6000
end;
Can someone explain me why is it constructed like that?