Tuesday, October 26, 2010

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)



2010/10/26 Tom Evans <tevans.uk@googlemail.com>
I'm curious, why can't I talk you into
Student.objects.all().order_by('-score')[0] ?

It is clearly a superior query :/

This would select only one row; there can possibly be multiple students with a top note.

Am I right? :)

Regards,
Piotr 

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment