Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django querset group by sum

 from django.db.models import Sum

  result = Books.objects.values('author')
                        .order_by('author')
                        .annotate(total_price=Sum('price'))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #querset #group #sum
ADD COMMENT
Topic
Name
7+2 =