gpt4 book ai didi

mysql - DQL 查询失败

转载 作者:可可西里 更新时间:2023-11-01 06:38:00 25 4
gpt4 key购买 nike

我在 MySQL 数据库中有 2 个表,我使用的是 doctrine 1.2 和 symfony 1.4.4

装机量和备用量

Installedbase:
ib_id
app_id
location

Spare:
spare_id
app_id
amount

现在我想加入表以显示有多少应用程序处于备用状态。

例如

$q = self::createQuery("l")
->select('i.*, s.*')
->from('InstalledBase i, Spare s')
->execute();

return $q;

Doctrine 知道 app_id 字段上的表之间存在关系,但我收到错误

500 | Internal Server Error | Doctrine_Hydrator_Exception 
"Spare" with an alias of "s" in your query does not reference the parent component it is related to.

标签: http://pastey.net/137237我无法弄清楚这一点,有人知道在提示什么 Doctrine 吗?

最佳答案

->from('InstalledBase i, i.Spare s')

...您查询中别名为“s”的“备用”未引用与其相关的父组件。

请向此查询添加一些进一步的条件,不要返回两个表中的所有内容。

关于mysql - DQL 查询失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2972330/

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