#588: Group by AND aggregate functions problem
------------------------------+---------------------------------------------
  Reporter:  elbouillon       |       Owner:  zYne-                
      Type:  defect           |      Status:  reopened             
  Priority:  major            |   Milestone:  1.0.0                
 Component:  Query/Hydration  |     Version:  0.10                 
Resolution:                   |    Keywords:                       
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+---------------------------------------------
Comment (by elbouillon):

 I tried something else :

 Doesn't work
 {{{
 Doctrine_Query::create()
                            ->select('tg.taggable_id, COUNT(tg.id) AS
 tg_count')
                            ->from('Tagging tg')
                            ->whereIn('tg.tag_id', array_keys($tag_ids))
                            ->groupBy('tg.taggable_id, tg.taggable_model')
                            ->having('count(tg.id) >= ?',
 $options['nb_common_tags'])
                            ->execute(array(), Doctrine::HYDRATE_NONE);
 }}}

 Work:
 {{{
 Doctrine_Query::create()
                            ->select('COUNT(tg.id) AS tg_count')
                            ->from('Tagging tg')
                            ->whereIn('tg.tag_id', array_keys($tag_ids))
                            ->groupBy('tg.taggable_id, tg.taggable_model')
                            ->having('count(tg.id) >= ?',
 $options['nb_common_tags'])
                            ->execute(array(), Doctrine::HYDRATE_NONE);
 }}}

 When I add something to select, doctrine automatically add the id to the
 select query...
 I hope this problem is clearly explained.

 Thanks!

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/588#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