Answer the question
In order to leave comments, you need to log in
Is it possible to "join" django queryset with custom sql query?
There is a rather complex aggregating (? like so) query.
SELECT mymodel.id as id,
SUM(...),
SUM(...)
COUNT(...)
FROM anothermodel
JOIN ... JOIN ...
WHERE mymodel.id IN (1,2,3,4)
GROUP BY mymodel.id, anothermodel.country
Answer the question
In order to leave comments, you need to log in
It is possible through extra / where, just the request will not be through join, but through a subqueryselect ... where id not in (select ...)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question