错误1054.Insert子句中的未知列 [英] error 1054. Unknown coloumn in Insert clause
本文介绍了错误1054.Insert子句中的未知列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个问题: 如果我写以下查询:
i have this problem: if i write the following query:
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的表的外键吗?
But in the table prodotto i have this coloumn and its named InseritoDa. Where am I wrong? the error may be due to the fact that the field InseritoDa is a foreign key that points to another table called 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子句.
Since the error states that it occured in a WHERE clause there might be an insert-trigger that executes another query and fails. There is no WHERE clause in your insert statement.
尝试像这样编辑您的INSERT触发器:
Try to edit your INSERT trigger like this:
update utente
set ProdottiInseriti = ProdottiInseriti + 1
where username = NEW.InseritoDa
这篇关于错误1054.Insert子句中的未知列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文