I am stuck in a situation where I need an equivalent Django ORM for the following sql query. Please help, I am new to django.
SELECT column1, column2, sum(column3) as total
FROM table1
GROUP BY column1;
I have tried
Table1.objects.values('column1', 'column2').annotate(total=Sum(column3))
Which makes the above orm as this:
SELECT column1, column2, sum(column3) as total
FROM table1
GROUP BY column1, column2;
It is grouping column1 and column2 which I dont want.