Hey, I want to count even null values using annotate. Is there a way
to do that?

Here is what I've done:

objects_aggr = objects.values(name).annotate(value=Count
(attribute)).order_by(name)

This does exactly what I want except that it does not count null
values. To count even null values I would need something like this:

SELECT Count(*), Count(attribute), ... FROM ... GROUP BY name

I've already tried to insert Count(*) using extra. But it seems to
have no effect.

Maybe it is possible to make Count's field argument optional and use
an asterisk if you just call Count()?

Cheers,
Thomas

--~--~---------~--~----~------------~-------~--~----~
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