I'm curious, why can't I talk you into
Student.objects.all().order_by('-score')[0] ?

It is clearly a superior query :/

Cheers

Tom

On Tue, Oct 26, 2010 at 6:37 AM, ankit rai <ankit9...@gmail.com> wrote:
> say your model name is Student, and it has a field names as marks
>
> query set will be
>
> Student.objects.all().aggregate(Max('marks')
> this will be give you max marks
>
> st=Student.objects.filter(marks__in=Student.objects.all().aggregate(Max('marks')))
>
> --ankit
>
>
> On Tue, Oct 26, 2010 at 9:28 AM, Phlip <phlip2...@gmail.com> wrote:
>>
>> Does anyone have a QuerySet for that?
>>
>> ( BTW please don't try to talk me out of it; I've been doing SQL since
>> 1989 and am fully aware of all the alternatives there. C-; )
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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