Thread: sum of sum
View Single Post
  #2 (permalink)  
Old 03-20-2008, 01:38 PM
amkma amkma is offline
WebProWorld New Member
 

Join Date: Oct 2004
Location: London
Posts: 6
amkma RepRank 0
Default 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?
Reply With Quote