I want to update two records from the age column in the table below, for this I use the following command:
UPDATE `persons` SET `Age` =( CASE WHEN FirstName = 'User 2' THEN 10 WHEN FirstName = 'User 3' THEN 12 END ) WHERE LastName = 'User';
According to the picture below, the rest of the age records are equal to null
Please guide me to solve this problem
2
Answers
use this query:
I recreated your table:
The updated statement would be for your case:
Result: