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

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

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

 result = Books.objects.values('author')
                       .order_by('author')
                       .annotate(count=Count('author'))