您好我正在尝试进行查询,我需要在where条件中传递sum函数。以下是查询。
$this->Transaction->virtualFields['total_amount'] = 'sum(total_amount)';
$this->paginate = array('conditions'=>$conditions,'order' => 'Transaction.title ASC', 'limit' => '15','group'=>'Transaction.order_id');
答案 0 :(得分:0)
尝试使用型号名称
$this->Transaction->virtualFields['total_amount'] = 'sum(total_amount)';
将其更改为
$this->Transaction->virtualFields['total_amount'] = 'sum(Transaction.total_amount)';