have you tried using another field to limit the results? With limit your query still goes thought all the registers in the table, but if you use another column in the where clause you can limit and the sum will work. maybe if you limit by the ID, are they sequential?
*Rafael Machado Dohms * *PHP Professional* *Blog:* *http://www.rafaeldohms.com.br <http://www.rafaeldohms.com.br/>* /- AJAX, PHP, XML, JavaScripy, MySQL / agneady wrote: > > Let's say I have a query like this one: > > select score from exams limit 20,10 > > So, it returns the scores for records 20-29 from the exams table. Now, > I want the sum of these returned scores. If I use: > > select sum(score) from exams > > it returns the sum of all scores. What I want is the sum of scores x > to y only. Can this be done with a MySQL query? I know I can do it in > PHP easily, but I want to do it through a query if possible. > > [Non-text portions of this message have been removed] The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
