#10060: Multiple table annotation failure
-------------------------------------+--------------------------------------
Reporter: [email protected] | Status: new
Milestone: post-1.0 | Component: ORM aggregation
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
-------------------------------------+--------------------------------------
Annotating across multiple tables results in wrong answers. i.e.
In [110]: total =
Branch.objects.all().annotate(total=Sum('center__client__loan__amount'))
In [111]: total[0].total
Out[111]: 3433000
In [112]: repaid =
Branch.objects.all().annotate(repaid=Sum('center__client__loan__payment_schedule__payments__principal'))
In [113]: repaid[0].repaid
Out[113]: 1976320.0
In [114]: both =
Branch.objects.all().annotate(total=Sum('center__client__loan__amount'),repaid=Sum('center__client__loan__payment_schedule__payments__principal'))
In [115]: both[0].repaid
Out[115]: 1976320.0
In [116]: both[0].total
Out[116]: 98816000
^^^^^^^^^^^
Compare the output of total in 116 vs. 111 (the correct answer).
--
Ticket URL: <http://code.djangoproject.com/ticket/10060>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---