<?php
// Make a MySQL Connection
$query = "SELECT excel, SUM(excel) As SumExcel FROM customer ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
echo $row["SumExcel"];
?>
<?php
$query = "SELECT excel2 FROM test WHERE id = '1' ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$excel2 = $row["excel2"];
// Make a MySQL Connection
$query = "SELECT excel, SUM(excel) As SumExcel FROM customer ";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$SumExcel = $row["SumExcel"];
echo 'ผลลัพธิ์ คือ '.$excel2-$SumExcel;
?>