Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

group by month and year

Request.objects.extra({ "month": ExtractMonth('date_creation'),
                        "year": ExtractYear('date_creation') })
               .values('month', 'year')
               .annotate(total=Count('month'))
               .values('month', 'year', 'total')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #group #month #year
ADD COMMENT
Topic
Name
6+9 =