我有这个问题:
如果我编写以下查询:
INSERT INTO prodotto (Barcode, InseritoDa, DataInserimento, UrlImage)
VALUES ('vfr','ff','12-10-2012', 'vfr.jpg')
我收到此错误消息:
Error Code: 1054. Unknown column 'InseritoDa' in 'where clause'
但表中prodotto
我有这个专栏及其名称 InseritoDa。
我哪里错了?
该错误可能是由于该字段InseritoDa
是一个外键,指向另一个名为utente
?
与该表关联的触发器是:
-- Trigger DDL Statements
DELIMITER $$
USE `m4af`$$
CREATE
DEFINER=`root`@`localhost`
TRIGGER `m4af`.`IncrementaProdottiInseritiUtente`
AFTER INSERT ON `m4af`.`prodotto`
FOR EACH ROW
update utente as u
set ProdottiInseriti= (select ProdottiInseriti from utente where username= InseritoDa)+1
where u.username = InseritoDa$$
由于该错误表明它发生在WHERE子句中可能有一个插入触发器执行另一个查询并失败。您的插入语句中没有 WHERE 子句。
Edit
尝试像这样编辑您的 INSERT 触发器:
update utente
set ProdottiInseriti = ProdottiInseriti + 1
where username = NEW.InseritoDa
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)