<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 查询中的聚合值

        Aggregate values in Doctrine_RawSql queries(Doctrine_RawSql 查询中的聚合值)

      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 查询中的聚合值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Converting between timezones in PHP(在 PHP 中的时区之间转换)
                  PHP - strtotime, specify timezone(PHP - strtotime,指定时区)
                  Get current date, given a timezone in PHP?(获取当前日期,给定 PHP 中的时区?)
                  List of US Time Zones for PHP to use?(PHP 使用的美国时区列表?)
                  How to detect Ambiguous and Invalid DateTime in PHP?(如何在 PHP 中检测不明确和无效的 DateTime?)
                  How to update timezonedb in PHP (updating timezones info)?(如何在 PHP 中更新 timezonedb(更新时区信息)?)

                    <bdo id='s1sQ8'></bdo><ul id='s1sQ8'></ul>
                  • <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>
                      <tbody id='s1sQ8'></tbody>
                  • <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'>