gpt4 book ai didi

php - MySQL 错误 : 'Unkown column' tablename. 列名在 'on clause'

转载 作者:行者123 更新时间:2023-11-29 13:05:44 25 4
gpt4 key购买 nike

我正在尝试将 2 个表连接到另一个表。我有这个 SQL 查询:

SELECT
desc_1.description,
desc_2.description,
Object.objID,
Item.itemID
FROM
Object,
Item
INNER JOIN Foo desc_1 ON desc_1.descID = Object.objDescID
INNER JOIN Foo desc_2 ON desc_2.descID = Item.itemDescID;

但是我收到以下错误:

ERROR 1054: Unkown column 'Object.objDescID' in 'on clause'

期望的输出:

description | description | objID | itemID |
------------+-------------+-------+--------+
"Daughter" | "Shoes" | 20 | 25 |

有谁知道为什么会这样吗?该列存在于表中,我已检查拼写等。

最佳答案

您不能混合使用旧的隐式连接语法和显式连接语法。使用

SELECT desc_1.description,
desc_2.description,
Object.objID,
Item.itemID
FROM Object
INNER JOIN Item on { fill in the column that relate object and item }
INNER JOIN Foo desc_1 ON desc_1.descID = Object.objDescID
INNER JOIN Foo desc_2 ON desc_2.descID = Item.itemDescID;

关于php - MySQL 错误 : 'Unkown column' tablename. 列名在 'on clause',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22732090/

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