O.K. here's my problem I want to total couple of columns in my table according to name if i use just one SUM ilike this
mysql_select_db($database_pacontacts, $pacontacts);
$query_Recordset1 = "SELECT `contacts`.`fullname`, SUM(`games`.`play`) AS 'rplay' FROM contacts, games WHERE (`contacts`.`fullname` > ' ') AND (`games`.`name` = `contacts`.`fullname` AND `games`.`playaccept` <> 'B') GROUP BY `contacts`.`fullname` ORDER BY `contacts`.`fullname` ASC";
$Recordset1 = mysql_query($query_Recordset1, $pacontacts) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
it works fine.
But when i try to SUM 2 columns like this
mysql_select_db($database_pacontacts, $pacontacts);
$query_Recordset1 = "SELECT `contacts`.`fullname`, SUM(`games`.`play`) AS 'rplay', SUM(`games`.`play2`) AS 'rplay2' FROM contacts, games WHERE (`contacts`.`fullname` > ' ') AND (`games`.`name` = `contacts`.`fullname` AND `games`.`playaccept` <> 'B') OR (`games`.`name2` = `contacts`.`fullname` AND `games`.`playaccept2` <> 'B') GROUP BY `contacts`.`fullname` ORDER BY `contacts`.`fullname` ASC";
$Recordset1 = mysql_query($query_Recordset1, $pacontacts) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
it doesn't work. Any ideas how i can get the result right?
thanks in advance