On Thu, 2002-12-05 at 19:39, Michelle de Beer wrote:
> > you mean mySQL does the search on 100 first entries
> > and then order the
> > results, instead of getting the results and
> > returning only the first 100 ?
> > If yes I too would like to know what's the right way
> > to do it in SQL then ?
> 
> That is correct. This is what I have:
> 
> One table with 1000 records. Two columns, students
> names (name) and the total score of a test (total)
> 
> When I try this query, I sort by the highest total:
> Select * from mytable ORDER by total desc
> 
> When on the other hand I use this query, mySQL only
> takes the first hundred rows and sorts them:
> Select * from mytable ORDER by total desc limit 0, 100
> 
> The problem is that there can be a very high score at
> row 234, that should be in the top one hundred result,
> but this is left out.
> 
> So the question is, can I limit the result and get all
> the highest scores from my table with a query, or do I
> have to add a counter in my PHP-script that breaks out
> of the loop at 100?
> 
> Thanks,
> // Michelle
> sql, query
 Try this query then:
 select name,max(total) from mytable

John Coder
 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to