#1286: Bug: Doctrine fails when select count distinct, joining 3 tables.
--------------------------+-------------------------------------------------
  Reporter:  mrducnguyen  |       Owner:  jwage                
      Type:  defect       |      Status:  closed               
  Priority:  minor        |   Milestone:                       
 Component:  Attributes   |     Version:  1.0.0                
Resolution:  invalid      |    Keywords:                       
  Has_test:  0            |    Mystatus:  Pending Core Response
 Has_patch:  0            |  
--------------------------+-------------------------------------------------
Changes (by jwage):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 I think the issue is that you're not selecting any columns from the inner
 joins. Can you test and re-open if that is not the case?

 Try this
 {{{
 $result = Doctrine_Query::create()->select("c.*, d.id, h.id,
 COUNT(DISTINCT h.id) as count_house")
                                 ->from("City c")
                                 ->innerJoin("c.Districts d")
                                 ->innerJoin("d.Houses h")
                                 ->groupBy("c.id")
                                 ->orderBy("count_house DESC")
                                 ->limit($limit)
                                 ->execute();

 }}}

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1286#comment:12>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to