amount 100 2000 3000 400
i have column in database how can sum in cakephp. , print value.
records->find('all', array( 'conditions' => array( 'records.amount' => $conditions), 'fields' => array('sum(records.amount) total_sum' ) ) ); pr($sum);
because have checked end given query as
$sum = $this->price->find('all', array('fields' => array('sum(price.flag_fall) total_sum' ) ) ); pr($sum);
it give output: array ( [0] => array ( [0] => array ( [total_sum] => 305.600 )
)
)
i think query correct please check $condition variable. , more information use below mention link. sum() function in cakephp query
i hope more helpful
thanks & regards, krishan
Comments
Post a Comment