Opened 7 years ago
Last modified 7 years ago
#30394 closed Bug
Mutiple annotation with Sum return wrong values. — at Initial Version
| Reported by: | Gouri Javed | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.11 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
UserRoleAccount.objects.filter(pk='24f4a032-3f83-4123-8330-fa60fcbb880c').aggregate(
given_count=Sum(
Case(When(user_observations_givengroup=grp, then=1),
output_field=IntegerField())
),
taken_count=Sum(
Case(When(user_observations_takengroup=grp, then=1),
output_field=IntegerField())
)
)
Note:
See TracTickets
for help on using tickets.