I'm having a bit of hard time with aggregation.

For simplicity's sake consider the models available in the aggregation
docs:
https://docs.djangoproject.com/en/1.3/topics/db/aggregation/#

This query:
Publisher.objects.filter(book__rating__gt=3.0).annotate(num_books=Count('book'))
returns all the publishers with at least one good book (ranked > 3)
with annotated the number of good books for each publisher.

How can i modify the query to get the list of ALL publishers with
annotated the number of good books for each publisher?
In other words I want to keep in the results also the Publishers
without good books (num_books = 0).

Ciao
Enrico

PS: Sorry for my horrible english

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to