gpt4 book ai didi

mysql - 数据库查询未提取完整(或正确)信息

转载 作者:行者123 更新时间:2023-11-29 15:44:47 24 4
gpt4 key购买 nike

我一直在研究多表查询(我对此没有太多经验),起初我认为它工作得很好,直到我注意到一半的结果有空值。我已将查询和表结构放在下面,因此我们将不胜感激!

SELECT
i.name, i.material, i.price, a.str_mod, a.def_mod,
a.dex_mod, a.spd_mod, i.level_req
FROM `character` as c
LEFT JOIN item_owned as o ON c.uid = o.oid
LEFT JOIN items as i ON o.iid = i.id
LEFT JOIN armour as a ON i.id = a.aid
WHERE uid = :id AND o.equipped = 1 AND i.type = 'Armour'

上面是我一直在运行的查询,下面是表结构 Armour talbe Items table Items Owned table

最佳答案

感谢 Malfunct on discord 找到了解决方案...查询有一个列拼写错误,所以应该是

SELECT 
i.name, i.material, i.price, a.str_mod, a.def_mod, a.dex_mod, a.spd_mod, i.level_req
FROM `character` as c
JOIN item_owned as o ON c.uid = o.oid
JOIN items as i ON o.iid = i.id
JOIN armour as a ON i.id = a.aid WHERE uid = 1
AND o.equipped = 1
AND i.type = 'Armour'

关于mysql - 数据库查询未提取完整(或正确)信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57191539/

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