[英]Error Code: 1052 when INSERTing (ID in field list is ambiguous)
I am being thrown a really weird error code, judging that I have successfully INSERTed values using the same query in a similar schema. 我被抛出一个非常奇怪的错误代码,断定我已经使用相似模式中的相同查询成功插入了值。
I am trying to execute the following query: 我正在尝试执行以下查询:
INSERT INTO part_approval (part_quote_key)
SELECT part_quote_key
FROM database.part_quote;
The part_approval table is empty and columns are either NULLable or have DEFAULT values. part_approval表为空,列为可为空或具有DEFAULT值。 The part_quote table looks like this:
part_quote表如下所示:
part_quote_key price batch part_key quote_key
1 12.90 30 5 17 2014-06-03 15:53:18
2 22.87 15 8 17 2014-06-03 16:14:52
3 19.96 15 9 17 2014-06-03 15:53:18
4 24.52 15 10 17 2014-06-03 15:53:18
5 13.65 15 14 17 2014-06-03 16:14:52
The error details point to "Column part_key is ambiguous in field list". 错误详细信息指向“字段列表中的列part_key不明确”。 However, the part_key column is not even in my result list of the above SELECT statement.
但是,part_key列甚至不在上述SELECT语句的结果列表中。
In addition, I've used the following statement to populate a similar table and it worked: 此外,我使用以下语句填充了一个相似的表,并且该表有效:
INSERT INTO component_approval (component_quote_key)
SELECT component_quote_key
FROM database.component_quote;
Is there anything I am overlooking? 有什么我要注意的吗?
Thanks for all your help in advance, Marius 谢谢您提前提供的所有帮助,Marius
Please try running your query by qualifying the columns by prefixing the table name or alias. 请尝试通过为表名或别名加上前缀来限定列来运行查询。
Refer this simmilar question: 1052: Column 'id' in field list is ambiguous 请参考以下类似问题: 1052:字段列表中的列“ id”不明确
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.