I am looking to do the same thing as this using cakephp:
https://stackoverflow.com/a/6127471
$eachRWithCode = $this->MovieReview->find( 'all', array(
'fields' => 'MovieReview.*',
'group' => array('MovieReview.code'),
'recursive' => '-1',
'nofilter' => true,
'order' => 'MovieReview.code'
));
This code gives an error:
ERROR: column "MovieReview.id" must appear in the GROUP BY clause or be used in an aggregate function