学说2.1 - FROM中的子选择?

时间:2011-10-28 14:33:08

标签: php doctrine doctrine-orm

AHOI! 即时搜索在DQL中生成这样的查询的方法

SELECT a.allRegistrations, b.allEvents
FROM 
( SELECT count(r0.ID)  AS allRegistrations
  FROM SPRegistration r0 ) a,
( SELECT count(e1.ID) AS allEvents
  FROM SPEvent e1 ) b;

当我尝试在“from”方法中添加一个子选择时,它最终会出现“Error:Class'('未定义。”

此查询的替代方法是....

SELECT 
( SELECT count(r0.ID)  AS allRegistrations
  FROM SPRegistration r0 ) AS allRegistrations;

我刚接触学说...现在经过几个小时的搜索,我想在这里询问是否有人知道如何构建这样的查询。

1 个答案:

答案 0 :(得分:0)

目前唯一的方法是使用:

$results = $qb->createQuery('*your select with sub query*')->getResult();