There is example in Django documentation about using Aggregate and Annotate
clauses
The same rules apply to the aggregate() clause. If you wanted to know the
lowest and highest price of any book that is available for sale in a store,
you could use the aggregate:
Store.objects.annotate(min_price=Min('books__price'),
max_price=Max('books__price'))
Store.objects.aggregate(min_price=Min('books__price'),
max_price=Max('books__price'))
By this string of code I'll get min/max price each of book in each store
But I won't see name or id of book, which was selected during use of
aggregation (max or min)
So the question... How can I get records
store min/max price *book ???*
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/814ef5a3-6e2b-4054-9a1c-6ca127c2d527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.