Re: Total Values with MySQL
| From: | Adam Voigt | Date: | Mon, 02 Jun 2003 15:25:07 +0000 |
| Subject: | Re: Total Values with MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28233@lists.php.net to get a copy of this message | ||
SELECT SUM(ColumnName) AS total FROM table WHERE ColunName = '1';
On Mon, 2003-06-02 at 11:18, shaun wrote:
> Hi,
>
> Is it possible to get MySQL to total the values of a select statement, say
> 'SELECT ColumnName FROM Table WHERE ColumnName = '1''
>
> Say I have three values in ColumnName all of '1' then can I get MySQL to
> return 3?
>
> Thanks for your help
--
Adam Voigt (adam@cryptocomm.com)
Linux/Unix Network Administrator
The Cryptocomm Group