php - SQL data within the last year -
i have created query seems execute no errors. getting total of 2 columns in 2 different fields related 1 customer, want retrieve data within past year.
i have used seems throw data stored.
$yearago = (date('y')-1).date('-m-d'); $sumtotal = $adb->pquery("select sum(currentamount), sum(newcurrentamount), (sum(currentamount) + sum(newcurrentamount)) 'total' vtiger_addisa, vtiger_isa vtiger_addisa.addrelatedclient = $relatedclient , vtiger_isa.relatedclient = $relatedclient , vtiger_isa.startdate >= $yearago "); $sumtotal->fetchinto($row); $clientotal = $row['total']; echo $clientotal; //print_r($sumtotal);
Comments
Post a Comment