gpt4 book ai didi

mysql - 错误代码: 1052 when INSERTing (ID in field list is ambiguous)

转载 作者:行者123 更新时间:2023-11-30 00:11:21 25 4
gpt4 key购买 nike

我被抛出一个非常奇怪的错误代码,判断我已经在类似的模式中使用相同的查询成功插入了值。

我正在尝试执行以下查询:

INSERT INTO part_approval (part_quote_key)
SELECT part_quote_key
FROM database.part_quote;

part_approval 表为空,并且列可以为 NULL 或具有 DEFAULT 值。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

错误详细信息指向“字段列表中的列part_key不明确”。但是,part_key 列甚至不在上述 SELECT 语句的结果列表中。

此外,我使用以下语句来填充类似的表并且它有效:

INSERT INTO component_approval (component_quote_key)
SELECT component_quote_key
FROM database.component_quote;

有什么我忽略的地方吗?

感谢您提前提供的所有帮助,马吕斯

最佳答案

请尝试通过在表名或别名前面加上前缀来限定列来运行查询。

引用这个类似的问题: 1052: Column 'id' in field list is ambiguous

关于mysql - 错误代码: 1052 when INSERTing (ID in field list is ambiguous),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24020611/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com