#32155: Count() by default uses group by
-------------------------------------+-------------------------------------
Reporter: Sukhinder Mann | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sukhinder Mann):
Replying to [comment:3 Simon Charette]:
> I think you're misunderstanding the `annotate` vs `aggregate` features
of the ORM.
>
> Annotations of aggregate functions have no choices but to group by the
queryset's model to provide a result for each rows. If you want to perform
an aggregation over filtered rows without grouping you'll want to use
`aggregate` instead.
>
> https://docs.djangoproject.com/en/3.1/topics/db/aggregation/
>
> Please use support channels and consult documentation before filling a
ticket next time as we use Trac solely for tracking feature requests and
confirmed bugs.
>
>
https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
Sorry for reporting a non-issue. This is completely my bad, you are
correct I should have used `aggregate` and not `annotate`. Appreciate your
help, thank you.
--
Ticket URL: <https://code.djangoproject.com/ticket/32155#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.b11780f8b75abd96fbc1b07940effcca%40djangoproject.com.