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

          <bdo id='1uQ7x'></bdo><ul id='1uQ7x'></ul>

        Doctrine_RawSql 查询中的聚合值

        时间:2024-08-15

      1. <legend id='Tnfte'><style id='Tnfte'><dir id='Tnfte'><q id='Tnfte'></q></dir></style></legend>
          <tbody id='Tnfte'></tbody>

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

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

            <bdo id='Tnfte'></bdo><ul id='Tnfte'></ul>

                  <tfoot id='Tnfte'></tfoot>
                  本文介绍了Doctrine_RawSql 查询中的聚合值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以在 Doctrine_RawSql 查询中使用聚合值?这是我正在尝试做的事情:

                  Is it possible to use aggregate values in Doctrine_RawSql query? Here's what I'm trying to do:

                  $q = new Doctrine_RawSql();
                  $q->select('{q.*}, AVG(a.value) AS avg');
                  $q->from('-- complex from clause');
                  $q->addComponent('q', 'Question');
                  

                  但是,Doctrine 创建的 SQL 只保留表 question 中的列,并省略聚合值 avg.

                  However, SQL created by Doctrine leaves only columns from table question and omits aggregate value avg.

                  推荐答案

                  我之前从未使用过Doctrine_RawSql,但是我使用这两种方法之一通过Doctrine 完成了原始SQL 查询:

                  I've never used Doctrine_RawSql before, but I have done raw SQL queries through Doctrine using either of these two methods:

                  Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAssoc("YOUR SQL QUERY HERE");
                  

                  $doctrine = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh();
                  $result = $doctrine->query('YOUR SQL QUERY HERE');
                  

                  这两种方法似乎会使您的原始 SQL 保持不变.

                  It seems like these two methods would leave your original SQL intact.

                  我应该注意,我在 Symfony 1.4 应用程序的上下文中使用 Doctrine 1.2,但是 AFAIK,无论您使用什么其他框架,这都对您有用.

                  I should note that I'm using Doctrine 1.2 within the context of Symfony 1.4 applications, but AFAIK, this would work for you regardless of what other frameworks you may be using.

                  这篇关于Doctrine_RawSql 查询中的聚合值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:让 Doctrine 使用 MySQL “FORCE INDEX" 下一篇:Symfony2 DoctrineFixturesBundle 命名空间错误

                  相关文章

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

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