Opened 6 years ago
Closed 6 years ago
#30262 closed Cleanup/optimization (duplicate)
Do not create GROUP BY clause expressions for Subqueries
Reported by: | Paul Wayper | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Normal | Keywords: | group by |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A Subquery in an annotation on a queryset can contains its own aggregate functions (e.g. COUNT) on the subquery's fields. However, these subqueries do not need to be included as GROUP BY clauses in the original query.
Change History (2)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I've written a patch to do this:
https://github.com/django/django/pull/11092
Let me know what you think!