The request is converted to something like this:
SELECT *
FROM Job
GROUP BY
some_field
This is an invalid request according to standards SQL, however it works MySQLdue to extensions MySQL GROUP BY.
You need to leave only grouped columns or aggregates in the sentence SELECT:
SELECT some_field, COUNT(*)
FROM Job
GROUP BY
some_field
with something like this:
$this->Job->find('all', array(
'fields' => array('Job.some_field', 'COUNT(*)'),
'group' => array('Job.some_field'),
'recursive' => -1
));
source
share