蛋糕php数量不同

Mr *_*ose 2 cakephp

这个Cakephp查询如何计算清楚?

        $matches = $this->Product->find('count', array(
            'conditions' => array(
                "Product.brand_id" => $brand['Brand']['id'],
                'Product.active' => 1

        ));
Run Code Online (Sandbox Code Playgroud)

C T*_*vel 5

像这样的东西?

$matches = $this->Product->find('count', array(
    'fields' => 'DISTINCT Product.brand_id',
    'conditions' => array("Product.brand_id" => $brand['Brand']['id'],
            'Product.active' => 1)
    ));
Run Code Online (Sandbox Code Playgroud)