Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django queryset group by count

 from django.db.models import Count

 result = Books.objects.values('author')
                       .order_by('author')
                       .annotate(count=Count('author'))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #queryset #group #count
ADD COMMENT
Topic
Name
9+4 =