6
嗯,我已經找了很多地方在互聯網上的mysql error #1442
的原因它說mysql錯誤1442的真正原因是什麼?
無法更新,因爲它 已經使用的語句表中存儲函數/觸發「unlucky_table」,這調用這個存儲 函數/觸發器
有人說這是一個在mysql或它不提供的功能的錯誤。
現在我無法理解爲什麼這是遞歸的。我在我有2個表table1
和table2
的情況下,我運行SQL查詢作爲
update table1 set avail = 0 where id in (select id from table2 where duration < now() - interval 2 hour);
現在我上table1
具有after update trigger
作爲
CREATE TRIGGER trig_table1 AFTER UPDATE ON table1
FOR EACH ROW begin
if old.avail=1 and new.avail=0 then
delete from table2 where id=new.id;
end if;
現在
當我執行更新查詢我得到1442錯誤。 在這種情況下什麼是遞歸?
is this error a lack of feature in mysql?
OR
does this have to do with how mysql executes queries?
OR
is there something logically wrong with executing such queries?
其UPDATE表名WHERE id(SELECT id FROM tableName) – lovesh
我只是普遍評論說,你不能從你正在更新的表中選擇。只要它具有相同的表名,它在哪裏並不重要。我正在查找爲什麼該觸發器現在失敗。但我99%確定以上是爲什麼它不起作用。 – BradLaney
我知道它不工作這就是我要求的原因 – lovesh