2

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
;
Sloan Thrasher
  • 4,953
  • 3
  • 22
  • 40
  • Have you tried googling the error message? Or searching here on SO? If you do, you will find many results that explain the error message and how to fix it. – Sloan Thrasher Apr 29 '18 at 00:32
  • Yes I did , they mostly talk about SQL_SAFE_UPDATES = 0 but I didn't understand how rely this work I am student started the learn MySQL I dint wanna break my settings because I need my program at school.I was expecting this code should work – sinan cengiz Apr 29 '18 at 00:37
  • Well, you found the answer, you just need to use it. You can always change the setting back. – Sloan Thrasher Apr 29 '18 at 00:51
  • Glad to help. Good luck with your project! Come back anytime when you get stuck. – Sloan Thrasher Apr 29 '18 at 03:44

0 Answers0