MySQL query, SUM of multiple colums
Posted
by Mick
on Stack Overflow
See other posts from Stack Overflow
or by Mick
Published on 2010-03-19T13:26:17Z
Indexed on
2010/03/19
13:31 UTC
Read the original article
Hit count: 369
mysql-query
|php
Hi I have multiple columns in a mySQL table. Three of the columns are named i100s, i60s and i25s and what I want to do is get the sum of all three entries . currently I have this code
'$query= "SELECT SUM(i100s),SUM(i60s),SUM(i25s) AS tkit FROM event WHERE acc='100' " ;
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result) ;
$total = $row['tkit'];'
But it is not returning the correct result , can anyone help me please ?
Thanks Mick
© Stack Overflow or respective owner