GROUP BYの指定について | suzukiのCakePHPブログ

GROUP BYの指定について

ググると古い情報がたくさん引っかかるので、メモ。

以前の方法
$cond = array("1 =  1 GROUP BY Tag.id");
$this->Tag->find("all", array("conditions" => $cond));

NowでYoungな方法
$group = "Tag.id";
$this->Tag->find("all", array("group" => $group));

CakePHPはどんどん進化していくなぁ~

参考:http://cakephp.jp/modules/newbb/viewtopic.php?topic_id=1202&forum=6