<bdo id='eKwc3'></bdo><ul id='eKwc3'></ul>
<legend id='eKwc3'><style id='eKwc3'><dir id='eKwc3'><q id='eKwc3'></q></dir></style></legend><tfoot id='eKwc3'></tfoot>

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

      1. InnerJoin 中的教义子查询

        Doctrine Subquery in InnerJoin(InnerJoin 中的教义子查询)
        • <bdo id='xNSUp'></bdo><ul id='xNSUp'></ul>
          <i id='xNSUp'><tr id='xNSUp'><dt id='xNSUp'><q id='xNSUp'><span id='xNSUp'><b id='xNSUp'><form id='xNSUp'><ins id='xNSUp'></ins><ul id='xNSUp'></ul><sub id='xNSUp'></sub></form><legend id='xNSUp'></legend><bdo id='xNSUp'><pre id='xNSUp'><center id='xNSUp'></center></pre></bdo></b><th id='xNSUp'></th></span></q></dt></tr></i><div id='xNSUp'><tfoot id='xNSUp'></tfoot><dl id='xNSUp'><fieldset id='xNSUp'></fieldset></dl></div>

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

              • <legend id='xNSUp'><style id='xNSUp'><dir id='xNSUp'><q id='xNSUp'></q></dir></style></legend>

                  <tbody id='xNSUp'></tbody>

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

                  问题描述

                  我在 MySql 中有功能查询:

                  select t.won,e.etot, s.username,s.country,r.points,r.rank FROM sf_guard_user sINNER JOIN 标记 r ON r.user_id = s.id内连接 (select t.user_id,count(t.user_id)as won from topper t group by t.user_id) t on t.user_id=s.id内连接(从 e.user_id 的考试 e 组中选择 e.user_id,count(e.user_id)as etot)e on e.user_id=s.idORDER BY r.rank asc

                  我在 sfGuardUserTable 类中编写了学说代码:

                  $q= $this->createQuery('u');$wq =$q->createSubquery()->select('t.user_id,count(t.user_id) 不会')->from('Topper t')->groupBy('t.user_id');$dq = $q->createSubquery()->select('e.user_id,count(e.user_id) etot')->from('考试 d')->groupBy('d.user_id');$q->select('t1.won, e1.dtot, u.username,u.country,r.points,r.rank')->innerJoin ('u.Marks r ON r.user_id = u.id')->innerJoin ('u.('.$wq->getDql().') t1 on t1.user_id=u.id')->innerJoin ('u.'.$dq->getDql().' e1 on e1.user_id=u.id')->orderBy('r.rank asc');//echo $q->getSql();返回 $q;

                  它给出错误找不到类 SELECT :(请帮助我.在此先感谢.

                  解决方案

                  我尝试通过 Doctrine Row Sql 查询选项及其工作直接执行我的自定义查询 :)我喜欢在这里分享:

                  $q = new Doctrine_RawSql();$q->select('{t.won}, {e.etot}, {s.username},{s.country},{r.marks},{r.ranks}');$q->from('sf_Guard_User s INNER JOIN 标记 r ON r.user_id = s.id 内连接 (select t.id,t.user_id,count(t.user_id) as won from topper t group by t.user_id) t on t.user_id=s.id inner join (select d.id,d.user_id,count(e.user_id)as etot 从exams e group by e.user_id) e on e.user_id=s.id ORDER BYr.rank asc');$q->addComponent('s', 'sfGuardUser s');$q->addComponent('r', 's.Marks r');$q->addComponent('t', 's.Topper t');$q->addComponent('e', 's.Exams e');返回 $q;

                  更多帮助阅读.p>

                  i have functional query in MySql:

                  select t.won,e.etot, s.username,s.country,r.points,r.rank FROM sf_guard_user s 
                  INNER JOIN marks r ON r.user_id = s.id 
                  inner join (select t.user_id,count(t.user_id)as won from topper t group by t.user_id) t on t.user_id=s.id
                  inner join (select e.user_id,count(e.user_id)as etot from exams e group by e.user_id) e on e.user_id=s.id
                  ORDER BY r.rank asc
                  

                  i wrote doctrine code in sfGuardUserTable Class:

                  $q= $this->createQuery('u');
                  
                          $wq =$q->createSubquery()
                           ->select('t.user_id,count(t.user_id) won')
                           ->from('Topper t')
                           ->groupBy('t.user_id');
                  
                          $dq = $q->createSubquery()
                           ->select('e.user_id,count(e.user_id) etot')
                           ->from('Exams d')
                           ->groupBy('d.user_id');
                  
                          $q->select(' t1.won, e1.dtot, u.username,u.country,r.points,r.rank')
                           ->innerJoin ('u.Marks r ON r.user_id = u.id')
                           ->innerJoin ('u.('.$wq->getDql().') t1 on t1.user_id=u.id')
                           ->innerJoin ('u.'.$dq->getDql().' e1 on e1.user_id=u.id')
                           ->orderBy('r.rank asc');
                  
                          //echo $q->getSql();
                          return $q;
                  

                  it is giving error Couldn't find class SELECT :( please help me. Thanks in Advance.

                  解决方案

                  i tried to execute my custom query directly by Doctrine Row Sql query option and its work :) i loved to share it here :

                  $q = new Doctrine_RawSql();
                          $q->select('{t.won}, {e.etot}, {s.username},{s.country},{r.marks},{r.ranks}');
                          $q->from('sf_Guard_User s INNER JOIN marks r ON r.user_id = s.id inner join (select t.id,t.user_id,count(t.user_id)as won from topper t group by t.user_id) t on t.user_id=s.id inner join (select d.id,d.user_id,count(e.user_id)as etot from exams e group by e.user_id) e on e.user_id=s.id ORDER BY r.rank asc');
                          $q->addComponent('s', 'sfGuardUser s');
                          $q->addComponent('r', 's.Marks r');
                          $q->addComponent('t', 's.Topper t');
                          $q->addComponent('e', 's.Exams e');
                          return $q;
                  

                  for more help read it.

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

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

                  相关文档推荐

                  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(更新时区信息)?)

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

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

                          <bdo id='l4i4U'></bdo><ul id='l4i4U'></ul>
                            <tbody id='l4i4U'></tbody>