2007年
8月 07
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 をうまく使っているということですね。
関連する投稿
Leave a Reply
Additional comments powered by BackType



Recent Comments