多连接中的主义查询语法错误 [英] Doctrine query syntax error in multiple join
本文介绍了多连接中的主义查询语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Symfony2项目中查询模型,但有一个小问题,我无法弄清楚。检查一下:
I'm trying to query the model in my Symfony2 project, and I have a little problem that I can't figure out. Check this out:
$q2 =
'SELECT
p.code,
p.desc,
SUM(d.quantity) as quantity,
SUM(d.quantity*d.prize) as euros
FROM
Product p
JOIN
TransactionDetail d
JOIN
d.transaction t
WHERE
d.product IN :array
AND
t.shop = :shop
GROUP BY
p.code';
$query2 = $this->em->createQuery($q2)
->setParameter('shop', $shop)->setParameter('array', $array);
$result = $query2->getResult();
我收到此错误:
[Syntax Error] line 0, col 248: Error: Expected =, <, <=, <>, >, >=, !=, got 't'
我不明白。有人可以在这里帮助我吗?
I don't understand it. Can anyone help me here?
谢谢。
推荐答案
我认为您应该将TransactionDetail与另一个实体链接:
I think you should link TransactionDetail with another entity :
当前:
JOIN
TransactionDetail d
应为:
JOIN
p.transactionDetail d
这篇关于多连接中的主义查询语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文