📜  django queryset group by sum - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:24.005000             🧑  作者: Mango

代码示例1
from django.db.models import Sum

  result = Books.objects.values('author')
                        .order_by('author')
                        .annotate(total_price=Sum('price'))