Re: How to write raw SQL or ORM for Count

2019-12-12 Thread Dvs Khamele
Hi We are worlds first affordable Python, Django Based Web Developement Startup. And can help you in this and related tasks / projects immidiately mere at $7 per hour. On Mon, 2 Dec 2019 at 19:13, xiaopeng luo wrote: > I am new to django ORM, I want query something like this: > > input: > AAA

Re: How to write raw SQL or ORM for Count

2019-12-02 Thread Luqman Shofuleji
You need to do some little reading about Django aggregation https://docs.djangoproject.com/en/2.2/topics/db/aggregation/#topics-db-aggregation Example from django.db.models import Max, Count, Sum Publisher.objects.values('name').annotate(*dcount*=Count('name')) As seen above you can apply

Re: How to write raw SQL or ORM for Count

2019-12-02 Thread RONAK JAIN
What you want to hear please cear that one.. Thanks On Mon, 2 Dec 2019, 19:13 xiaopeng luo, wrote: > I am new to django ORM, I want query something like this: > > input: > AAAfemale1 > AAAfemale2 > BBBmale 1 > BBBmale 3 > AAAmale 2 > > > > output >

How to write raw SQL or ORM for Count

2019-12-02 Thread xiaopeng luo
I am new to django ORM, I want query something like this: input: AAAfemale1 AAAfemale2 BBBmale 1 BBBmale 3 AAAmale 2 output AAAfemale3 AAAmale 2 BBBmale 4 Sorry, my english is not good. Thanks for everyone help me. --