Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] mysql-SUM From: Richard Lynch (richard <email protected>)
Date: 05/15/00

In article <de.4f50d21.26510b4b <email protected>>, CrazYpdesign <email protected> wrote:

> my table "data"
>
> l options l votes l
> l 1 l 5 l
> l 2 l 6 l
>
> i need to add the votes together so it outputs like this
> | options | votes | total |
> | 1 | 5 | 11 |
> | 2 | 6 | null |
>
> what would i type to get that?
> i know its not php but i need the query string.

select options, votes, sum(votes) as total from ...

You'll get 11 all the way down, though, not 11 in one row and null in the
next...

-- 
Richard Lynch                | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA        | http://www.L-I-E.com/artists.htm
http://www.zend.com          | (this has nothing to do with Zend, duh!)

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>