#10060: Multiple table annotation failure
-------------------------------------+-------------------------------------
     Reporter:  svsharma@…           |                    Owner:
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by camillobruni):

 Replying to [comment:50 camillobruni]:
 > I recently ran into a similar problem. The deep joining causes an
 explosion of values possibly resulting in many duplicate values. I fixed
 this in https://github.com/django/django/pull/4388 by implementing the
 DISTINCT parameter on the Aggregate functions. Hence you can do
 > {{{Sum('center__client__loan__payment_schedule__payments__principal',
 distinct=True)}}}
 > which ignores the duplicate entries.
 >
 > It might be that the issue at hand is slightly different, but this
 solves at least one particular case.

 Sorry for the noise, I was wrong (in hindsight: "obviously")
 http://www.sqlteam.com/article/how-to-use-group-by-with-distinct-
 aggregates-and-derived-tables describes the problem I thought of dealing
 with in more detail.

--
Ticket URL: <https://code.djangoproject.com/ticket/10060#comment:51>
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/081.7c507542032e94f8c6b300e70dc07e49%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to