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

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

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

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