#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 |
------------------------------+---------------------------------------------
Changes (by elbouillon):
* status: closed => reopened
* has_test: => 0
* priority: minor => major
* mystatus: => Pending Core Response
* milestone: 0.11.0 => 1.0.0
* has_patch: => 0
* resolution: fixed =>
Comment:
Hi, I think this is still not working... I'm trying to make this query :
{{{
$c = Doctrine_Query::create()
->select('tg.taggable_id, tg.taggable_model')
->from('Tagging tg, tg.Tag t')
->groupBy('tg.taggable_id, tg.taggable_model');
$c->execute(array(), Doctrine::HYDRATE_ARRAY);
}}}
I got an exception, because tg.id is added to my query... Below is the
generated one :
{{{
SELECT t.id AS t__id, t.taggable_id AS t__taggable_id, t.taggable_model AS
t__taggable_model
FROM tagging t LEFT JOIN tag t2 ON t.tag_id = t2.id
WHERE t2.name IN (?) GROUP BY t.taggable_id, t.taggable_model'
}}}
And the exception :
{{{
SQLSTATE[42803]: Grouping error: 7
ERROR: column "t.id" must appear in the GROUP BY clause or be used in an
aggregate function
}}}
I'm trying that in postgresql.
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/588#comment:10>
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
-~----------~----~----~----~------~----~------~--~---