Re: Using SQL aggregates

2007-08-30 Thread Eratothene
I know two options for you: 1. First use django-simpleaggregation plugin, you canfind it on googlecode.com 2. Or use raw sql to do it. This is example how I count entries in each blogs blogs = Blog.objects.all().extra(select={'article_count': "SELECT COUNT(*) FROM blog_article a WHERE a.blog_id=b

Re: Using SQL aggregates

2007-08-26 Thread Russell Keith-Magee
On 8/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > How can I display a table of groups and counts, using the DB API? Can > this be wrapped around a model that is tied to a database view? The short answer is that aggregates are a planned, but not yet implemented feature. The ticket disc

Using SQL aggregates

2007-08-25 Thread [EMAIL PROTECTED]
I'm new to Django, so this may be answered elsewhere but I have not found it. If I want to display a summary view of some large datasets, in SQL I would use: select name, count(*) from MyTable group by name This SQL in practice would have several joins. In past lives, I've used SQL VIEWS to hi