--
Ticket URL: <https://code.djangoproject.com/ticket/30394>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 2.2 => 1.11
Old description:
> UserRoleAccount.objects.filter(pk='24f4a032-3f83-4123-8330-fa60fcbb880c').aggregate(
> given_count=Sum(
> Case(When(user_observations_given__group=grp, then=1),
> output_field=IntegerField())
> ),
> taken_count=Sum(
> Case(When(user_observations_taken__group=grp, then=1),
> output_field=IntegerField())
> )
> )
New description:
UserRoleAccount.objects.annotate(count=Sum(Case(When(user_observations_taken__group=grp,then=1)),default=0,output_field=IntegerField(),distinct=True)).annotate(count1=Sum(Case(When(user_observations_given__group=grp,then=1)),default=0,output_field=IntegerField(),distinct=True))
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30394#comment:1>
* status: new => closed
* resolution: => duplicate
Comment:
[https://docs.djangoproject.com/en/2.2/topics/db/aggregation/#combining-
multiple-aggregations As documented] this is a duplicate of #10060.
--
Ticket URL: <https://code.djangoproject.com/ticket/30394#comment:2>