I am trying to update the total
of Payment
to the total of price
from Packages
where the transaction numbers are the same. However MySQL keeps giving me 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.
Here is the command:
UPDATE Payment py
SET total = (SELECT SUM(price) FROM Package pk
WHERE py.transactionNo = pk.transactionNo);
I would think that I am using a WHERE that uses a KEY column (transactionNo
is the primary key for Payment
). Am I simply writing this wrong?