mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1773: GRUOP BY table.id in PostgreSQL. #2230
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 8, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user elfet:
I use in mysql driver this DQL: "GRUOP BY table.id"
But when i shwich to PostgreSQL i have to rewrite it like this: "GRUOP BY table"
@doctrinebot commented on GitHub (Apr 21, 2012):
Comment created by @FabioBatSilva:
Hi Elfet
I can't reproduce.
Could you give more details, maybe attach your entities or a test case ?
Thanks
@doctrinebot commented on GitHub (Apr 21, 2012):
Comment created by elfet:
The DQL: SELECT g, COUNT(u.id) AS usersCount FROM Entity\Group g LEFT JOIN g.users u GROUP BY g{color:red}.id{color}
The Entity
@doctrinebot commented on GitHub (Apr 21, 2012):
Comment created by @FabioBatSilva:
Hi Elfet.
In some databases like postgres and oracle all selected columns must appear in the GROUP BY clause or be used in an aggregate function.
You CANNOT, select "Group" fields without add these field on the ORDER BY clause.
you should use :
( GROUP BY g )
or
( GROUP BY g.id, g.nome, g.otherSelectedFields )
@doctrinebot commented on GitHub (Apr 22, 2012):
Comment created by elfet:
Ok, thanks!
@doctrinebot commented on GitHub (Apr 22, 2012):
Issue was closed with resolution "Invalid"