HI mysql update

47 Views Asked by At

HI I want to change the first name to grouocho if name is harpo and last name is Williamns other vise I want to change to Mocho Groucho where first name is Harpo. When I run my code it gives me

Error   1175    You are using safe update mode and you tried to 
update a table without a WHERE that uses a KEY column

Could Anyone help me?

UPDATE actor
SET first_name = 
CASE 
    WHEN first_name = 'HARPO' AND last_name = 'Williams' THEN 'GROUCHO'
    WHEN first_name = 'HARPO' AND last_name != 'Williams' THEN 'MOCHO GROUCHO'
END
;
0

There are 0 best solutions below