I have started using aggregation, but it seems to ignore any slicing I
do on a QuerySet before calling aggregate. This is what I'm doing:
Product.objects.order_by("-price")[:100].values("price").aggregate(Max
("price"), Min("price"))
I want the maximum and minimum price for the products with the top 100
largest prices. The aggregate function, however, returns the maximum
and minimum price for all Products--it ignores the [:100] slice.
Is this an improper use of aggregation, or am I doing something wrong
with my query?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---