Re: sum of sum
I have tried these, But no luck.
$curdate=date("YmdHis");
$result=mysql_query("SELECT SUM(deposit_paid) AS depo + SUM(1st_installment) AS secpay + SUM(2nd_installment) AS thirdpay FROM payments WHERE deposit_paid_on_date = $curdate or installment_paid_on_date = $curdate or 2nd_installment_paid_on_date = $curdate");
OR
$result=mysql_query("SELECT SUM(deposit_paid + 1st_installment + 2nd_installment) AS totpay FROM payments WHERE deposit_paid_on_date = $curdate or installment_paid_on_date = $curdate or 2nd_installment_paid_on_date = $curdate");
while($row = mysql_fetch_array($result)){
echo "Total payments today= £ ". $row['totpay'];
}
where am I going wrong here? No error just doesnt display anything... Is this type of query even possible?
|