cakebaker ? Using distinct and count with CakePHP

CakePHP で DISTINCT を使いたい時の方法が紹介されていました。

$this->User->find(null, "COUNT(DISTINCT User.city) AS 'count'");

find は /cake/libs/model/model_php5.php
function find($conditions = null, $fields = null, $order = null, $recursive = null)
と定義されています。
この $fields をうまく使っているということですね。

関連する投稿