Cake php count distinct

How can I make this Cakephp request to be considered different?

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

        ));

      

+2


source to share


1 answer


Something like that?



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

      

+5


source







All Articles