Opened 7 years ago
Last modified 7 years ago
#28940 closed Uncategorized
Annotate SUM aggregation value as field — at Initial Version
Description ¶
Hello
How can I do this in Django without .extra() method?
SELECT SUM(column_1) AS total, column_1, column_2 FROM table
In your documentation you said that I should create the ticket if I use .extra() method, so I'm here
Model.objects.extra(select={'total': 'select sum(field) from model'})
Note:
See TracTickets
for help on using tickets.