Thanks so much for your response, Russell.

On Sat, 2007-11-10 at 12:10 +0900, Russell Keith-Magee wrote:
> 1) Get hold of a cursor and write the full SQL query you want
> yourself. It sounds like all you want is SELECT SUM(bar) FROM MYTABLE,
> so this may be the easiest and most stable solution.

As I mentioned, I want to start with a QuerySet that's been filter()ed,
so I'm trying to avoid that, because I don't want to build the WHERE
myself.

> 3) Specifying q.values('foo').extra(select={'foo': 'sum(bar)'}) -
> i.e., specifically request _no_ column values, other than the extra
> column.

Awesome, that did the trick. Thanks!

> There might be. However, we're not going to add a method to the API
> before we've had the full discussion on what the final form of
> aggregation will look like. The one thing we don't want to do is add a
> function, then take it away (or change it in some backwards
> incompatible way) at some later date once we've had the design
> discussion.

Yeah, I understand that, and I know how hard it is to get a release out
the door. Looking forward to the time after that. :-)

Now to look at how to make my own Manager with its own sum(field)
method, mmm...

Thanks again,

Steve


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to