我試圖創建一個觸發器更新整個表,其中Name ='test_user'。 這是我走到這一步:更新觸發MySQL不工作
CREATE TRIGGER users.insert_log
AFTER INSERT ON users.logBook
FOR EACH ROW
UPDATE users.logBook
SET UserName = 'SQL_TEST'
WHERE
UserName = 'test_user';
它創建了扳機,沒有任何問題。 但插入我得到這個錯誤時:
ERROR 1442 (HY000): Can't update table 'logBook' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
如何更新我行其中username = test_user?