Re: SUM(colname)
| From: | Foong | Date: | Sat, 18 Jan 2003 17:27:25 +0000 |
| Subject: | Re: SUM(colname) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-24932@lists.php.net to get a copy of this message | ||
if i am not mistaken
SELECT SUM(colname) WHERE value = 'value'
only return one row, and that's the sum you want i guess.
Foong
Cesar Aracena <icaam@icaam.com.ar> wrote in message
news:000001c2be5d$087868a0$7a00a8c0@NOTEBOOK...
Hi all,
I'm trying to add all the values from the same column in MySQL with a
query like this:
SELECT SUM(colname) WHERE value = 'value'
But then I can't output it on the screen correctly. I've tried to put
all the results into an array and then make an array_sum($arrayname) and
it gives me exactly the double of what it should... any suggestions? By
the way, the column I'm trying to add is a DOUBLE 6,2.
Thanks in advance,
Cesar L. Aracena
icaam@icaam.com.ar
caracena@infovia.com.ar
(0299) 156-356688
Neuquén (8300) Capital
Argentina