如何从我的paginate语句中获取DISTINCT值?

时间:2011-11-17 05:26:01

标签: php cakephp cakephp-1.3 cakephp-2.0

$this->Release->recursive = 0;
        $this->paginate['Release']['joins'] =
                       array(
                        array(
                            'table' => ' game_potential_amazon_matches',
                            'alias' => 'PotentialAmazonMatch',
                            'type' => 'inner',
                            'conditions' =>
                            array(
                                'PotentialAmazonMatch.release_id = Release.id'
                                )
                            )
                        );
        $this->set('releases', $this->paginate('Release'));
        $this->set('title_for_layout', 'Release with Potential Amazon Matches)');

我正在获取多条记录,并希望通过Release.id获得区分?

1 个答案:

答案 0 :(得分:0)

在这种情况下你必须使用DISTINCT in fields

conditions数组之后使用fields数组,如

fields => array('DISTINCE Release.id','field 2','field 3',...etc)