I have the following query:
UPDATE borsalino_db.reservations SET confirmed=if(confirmed=1, -1, 0) WHERE confirmed = 1;
This produces the error:
Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.
Only when i add
SET SQL_SAFE_UPDATES = 0;
UPDATE borsalino_db.reservations SET confirmed=if(confirmed=1, -1, 0) WHERE confirmed = 1;
SET SQL_SAFE_UPDATES = 1;
It works. But this seems wrong to me to do it like this. I do not want to disable safe mode.
So i tried to add confirmed as a primary key but still getting the error.
Any ideas on how to solve this? Thanks
