0
我該如何重現以下查詢cakePhp find() and conditions?Double group by inPhp
SELECT a, SUM(bTotal) as fullTotal FROM
(SELECT a, SUM(b) * c as bTotal FROM Table1
GROUP BY a)
GROUP BY a
在一般情況下,我怎麼能在cakePhp中編寫嵌套組?
編輯:
我可以用單組通過寫:
$results = $this->Vote->find('all', array('fields' => array('Choice.Answer', '(COUNT(Vote.id) * User.voteMultipler) AS voteTotal', 'choice_id', 'user_id'),
'group' => 'choice_id, Vote.user_id',));
我想組和回答總結的結果。
但它的SQL,我想改寫它作爲CakePHP的命令。 – boj
查看我的更新回答 –
技術上還是sql imo –