更新时间:2023-01-29 20:48:38
如果您使用PostgreSQL,以下内容可能会起作用:
If you're on PostgreSQL, the following might work:
from django.db.models import Count
Link.objects.extra(select={'month': 'extract( month from pub_date )'}).values('month').annotate(dcount=Count('pub_date'))
我不知道如何便携式提取
是跨其他数据库。
I'm not sure how portable extract
is across other databases.