使用cakephp2
$total = $this->order->find('all', array(
'fields' => array(SUM(order.vat)),
'conditions' => $condition
));
qazxsw poi功能对我不起作用,我收到错误:
调用未定义的函数SUM()
你需要这样写,
SUM
在$total = $this->order->find('all',array(
'fields'=>array('SUM(order.vat) as total_vat'),
'conditions'=>$condition
));
附近添加引号。
这是另一种解决方案。
SUM(order.vat)