#11305: Support for "Conditional Aggregates"
-------------------------------------+-------------------------------------
Reporter: bendavis78 | Owner:
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: aggregate, annotate | Triage Stage:
| Someday/Maybe
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jarshwah):
* status: new => closed
* resolution: => fixed
Comment:
#24031 is now implemented as well as #14030 so it's now possible to use
conditional aggregates:
{{{
>>> Client.objects.aggregate(
... regular=Sum(
... Case(When(account_type=Client.REGULAR, then=Value(1)),
... output_field=IntegerField())
... ),
... gold=Sum(
... Case(When(account_type=Client.GOLD, then=Value(1)),
... output_field=IntegerField())
... ),
... platinum=Sum(
... Case(When(account_type=Client.PLATINUM, then=Value(1)),
... output_field=IntegerField())
... )
... )
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/11305#comment:40>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.7eeb4c0bed6f2b0878c2a0197446193a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.