You need to do some little reading about Django aggregation
Example
from django.db.models import Max, Count, Sum
Publisher.objects.values('name').annotate(dcount=Count('name'))
As seen above you can apply similar method to get Max, Sum and others
On Mon, Dec 2, 2019 at 2:43 PM xiaopeng luo <xpluo.sim@gmail.com> wrote:
I am new to django ORM, I want query something like this:--input:AAA female 1AAA female 2BBB male 1BBB male 3AAA male 2outputAAA female 3AAA male 2BBB male 4Sorry, my english is not good. Thanks for everyone help me.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a297dc1f-6821-4bba-b04c-e8ce271b5a8d%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHyB84qihZj5mVNnL2C-BmE%3D2RAdsvVoOYfrfiH04BaPQ%3D5E2Q%40mail.gmail.com.
No comments:
Post a Comment