Whenever I do a:
$this->Job->find('all', array(
'group' => array('Job.some_field'),
'recursive' => -1
));
I get a :
SQL Error: Column 'jobs.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
With MySQL it works fine but with SQL Server 2008 it seems that group by doesn’t work anymore.
How do I fix this? Thanks in advance SQL gurus
The query is translated into something like this:
This is not a valid query according to
SQLstandards, however, it works inMySQLbecause ofMySQL‘sGROUP BYextensions.You need to leave only grouped columns or aggregates in the
SELECTclause:with something like this: