Hi Pete,

Sorry for repeated posting. You can do your SUM() via PHP too.

$query = mysql_query(select score from exams limit 20,10);

//put scores in array
while ( $row = mysql_fetch_arry($query) ){
        //put responses into array to sum
        $exam_scores[] = $row['score'];
}
//sum array of scrores
$sum_score = array_sum($exam_scores);

Sincerely,
Mike
--  
Mike Brandonisio          *    Web Hosting
Tech One Illustration     *    Internet Marketing
tel (630) 759-9283        *    e-Commerce
[EMAIL PROTECTED]    *    http://www.jikometrix.net

     JIKOmetrix - Reliable web hosting


On Aug 2, 2006, at 8:19 AM, 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.
>
>
>
>
>
>
> The php_mysql group is dedicated to learn more about the PHP/MySQL  
> web database possibilities through group learning.
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>



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/
 


Reply via email to