Answers for "django queryset group by sum"

0

django queryset group by sum

from django.db.models import Sum

  result = Books.objects.values('author')
                        .order_by('author')
                        .annotate(total_price=Sum('price'))
Posted by: Guest on September-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language