Re: Total Values with MySQL
| From: | Ronan Chilvers | Date: | Mon, 02 Jun 2003 15:25:41 +0000 |
| Subject: | Re: Total Values with MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28234@lists.php.net to get a copy of this message | ||
Hi Shaun
Comments inline...
On 02 Jun,2003 at 16:18 shaun 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?
Try the SUM() function as in:-
SELECT SUM(ColumnName) AS Total FROM Table WHERE ColumnName = '1';
??
>
> Thanks for your help
>
No problem
Ronan
e: ronan@thelittledot.com
t: 01903 739 997
w: www.thelittledot.com
The Little Dot is a partnership of
Ronan Chilvers and Giles Webberley