RE: [PHP] Sum a column of values from a MySQL query
| From: | Jay Blanchard | Date: | Tue, 05 Aug 2003 12:15:26 +0000 |
| Subject: | RE: [PHP] Sum a column of values from a MySQL query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-158267@lists.php.net to get a copy of this message | ||
[snip]
However, why not just SUM all the rows in the table in the query if you
just
want a total?
$sql_2 = "SELECT SUM(partpaidamount) as partpaid FROM $tb_name";
[/snip]
That is what he is doing. The SELECT SUM will only return ONE row! I am
not sure that the problem is being explained clearly though.