On Tuesday, December 8, 2015 at 1:26:52 AM UTC-6, Anssi Kääriäinen wrote:
>
>
> Come to think of it, we already have a workaround:
>    Book.objects.annotate(author_cnt=RawSQL("(select count(*) from author 
> where author.book_id = book.book_id)").
>

Yes, you can do a subquery to get the Sum or Count but then you cannot 
"filter": `qs.filter(author_cnt__gt=0)` won't work.

I think it would require the correct "GROUP BY" and "HAVING" clause to be 
able to filter, correct?


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/df291acb-a1cb-4afa-9310-1f0166c6bb0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to