On Wed, Jun 3, 2009 at 4:22 PM, Bobby Roberts <tchend...@gmail.com> wrote:

>
> hi group....
>
> how would i write a filter to do the equivalent of this sql query:
>
> "select year,count(year) from tablename order by year desc"
>
> to produce a result such as
>
> 2009   1000
> 2008   750
> 2007   722
> ...
>
>
>
>
> >
>
This is only possible in the django development version (and the 1.1 beta).
Take a look at the documentation on aggregates
http://docs.djangoproject.com/en/dev/topics/db/aggregation/ to see how to do
this.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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