<legend id='F5uOV'><style id='F5uOV'><dir id='F5uOV'><q id='F5uOV'></q></dir></style></legend>
    <bdo id='F5uOV'></bdo><ul id='F5uOV'></ul>
    <i id='F5uOV'><tr id='F5uOV'><dt id='F5uOV'><q id='F5uOV'><span id='F5uOV'><b id='F5uOV'><form id='F5uOV'><ins id='F5uOV'></ins><ul id='F5uOV'></ul><sub id='F5uOV'></sub></form><legend id='F5uOV'></legend><bdo id='F5uOV'><pre id='F5uOV'><center id='F5uOV'></center></pre></bdo></b><th id='F5uOV'></th></span></q></dt></tr></i><div id='F5uOV'><tfoot id='F5uOV'></tfoot><dl id='F5uOV'><fieldset id='F5uOV'></fieldset></dl></div>
  • <tfoot id='F5uOV'></tfoot>

      <small id='F5uOV'></small><noframes id='F5uOV'>

        DQL 中嵌套子查询中的错误:未定义类“("

        时间:2023-08-18
        <legend id='RMTSM'><style id='RMTSM'><dir id='RMTSM'><q id='RMTSM'></q></dir></style></legend>

          <tfoot id='RMTSM'></tfoot>

        1. <small id='RMTSM'></small><noframes id='RMTSM'>

                <tbody id='RMTSM'></tbody>
                <bdo id='RMTSM'></bdo><ul id='RMTSM'></ul>
                  <i id='RMTSM'><tr id='RMTSM'><dt id='RMTSM'><q id='RMTSM'><span id='RMTSM'><b id='RMTSM'><form id='RMTSM'><ins id='RMTSM'></ins><ul id='RMTSM'></ul><sub id='RMTSM'></sub></form><legend id='RMTSM'></legend><bdo id='RMTSM'><pre id='RMTSM'><center id='RMTSM'></center></pre></bdo></b><th id='RMTSM'></th></span></q></dt></tr></i><div id='RMTSM'><tfoot id='RMTSM'></tfoot><dl id='RMTSM'><fieldset id='RMTSM'></fieldset></dl></div>
                • 本文介绍了DQL 中嵌套子查询中的错误:未定义类“("的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 DQL,如下所示:

                  I have a DQL as like below:

                  SELECT at, count(at.id) FROM AccountTriple at JOIN at.property p JOIN at.account ac WHERE p.create_analytics = '1' GROUP BY at.property, at.value, ac.service
                  

                  如您所见,它具有三个连接.因为'at'和'ac'都有大量的数据.为了优化它,我试图将加入前的p.create_analytics = '1'"检查移至ac",以提供较小的数据集以供加入.我正在努力实现这样的目标:

                  As you can see, it has three joins. As 'at' and 'ac' both have large amount of data. In attempt to optimize it, I am trying to move the "p.create_analytics = '1'" checking before join to 'ac' to give it a smaller data set to join. I am trying to achieve something like this:

                  SELECT at, count(at.id) FROM ( SELECT at FROM AccountTriple at JOIN at.property p WHERE p.create_analytics = '1' ) JOIN at.account ac  GROUP BY at.property, at.value, ac.service
                  

                  但不知何故,我的语法不起作用.错误消息显示如下:

                  But somehow, my syntax isn't working. A error message is showing as below:

                  语义错误] '( SELECT at FROM' 附近的第 0 行第 29 行:错误:类 '(' 未定义.

                  Semantical Error] line 0, col 29 near '( SELECT at FROM': Error: Class '(' is not defined.

                  在其他任何地方也没有找到类似的例子.有没有人可以帮助修复此 DQL 查询以使其正常工作?提前致谢.

                  Didn't find similar example anywhere else as well. Does anyone can help to fix this DQL query to get working? Thanks in advance.

                  推荐答案

                  使用 createSubquery() 函数在 Doctrine 中创建子查询.然后,您可以将子查询嵌套到主查询中.

                  Use the createSubquery() function to create a subquery in Doctrine. You can then nest the subquery into your main query.

                  // build root query
                  $query = Doctrine_Query::create()
                    ->from('Movie m')
                    ->where('name = ?', 'Prometheus')
                  ;
                  
                  // build subquery
                  $subquery = $query->createSubquery()
                    ->from('SeenMovie sm')
                    ->where('m.name = sm.name')
                  ;
                  
                  // nest subquery and execute
                  $query->where('EXISTS (' . $subquery->getDql() . ')')->execute();
                  

                  进一步阅读
                  用于创建任何复杂性的 Doctrine 子查询的防弹模式

                  这篇关于DQL 中嵌套子查询中的错误:未定义类“("的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Doctrine 2.x ORM 中使用 REGEXP 下一篇:如何在实体表单类型中包含来自另一个实体的某些字段?

                  相关文章

                    • <bdo id='1Bxno'></bdo><ul id='1Bxno'></ul>

                    <legend id='1Bxno'><style id='1Bxno'><dir id='1Bxno'><q id='1Bxno'></q></dir></style></legend>
                  1. <small id='1Bxno'></small><noframes id='1Bxno'>

                    1. <tfoot id='1Bxno'></tfoot>
                    2. <i id='1Bxno'><tr id='1Bxno'><dt id='1Bxno'><q id='1Bxno'><span id='1Bxno'><b id='1Bxno'><form id='1Bxno'><ins id='1Bxno'></ins><ul id='1Bxno'></ul><sub id='1Bxno'></sub></form><legend id='1Bxno'></legend><bdo id='1Bxno'><pre id='1Bxno'><center id='1Bxno'></center></pre></bdo></b><th id='1Bxno'></th></span></q></dt></tr></i><div id='1Bxno'><tfoot id='1Bxno'></tfoot><dl id='1Bxno'><fieldset id='1Bxno'></fieldset></dl></div>