On 16 September 2011 22:57, dave bl <[email protected]> wrote:
> On 16 September 2011 22:39, Jani Tiainen <[email protected]> wrote:
>> 16.9.2011 15:27, dave bl kirjoitti:
>>>
>>> Hmm no I am not missing the point... I think the django devs are...
>>> sqlalchemy _has_ a group by.
>>>
>>> So I simply want to do this sql statement(using the django orm):
>>>
>>> select foo, count(foo), from bar group by foo;
>>>
>>> I _could_ use a .extra method to do this(and get stuck on $databases)
>>> ... or a loop... (non-sql). IMHO I should be able to do it via the
>>> orm. If you can do it via the orm - how do I do it ?
>>>
>>
>> Bar.objects.values('foo').annotate(Count('foo'))
>>
>> As written in Django documentation...
>
> Hmm I actually tried this and I wasn't able to get the correct results
> iirc. I'll try it again :)
>

Hmm, I must have put it in wrong before as it works perfectly now ^ ^.
Thank you :)

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

Reply via email to