I've got a Songs model, and each song HasMany Rating.

I want to query for a list of songs, and get the average Rating.

$this->Song->find('all', array(
        'fields' => 'Song.title',
        'contain' => array(Rating => array(
                'fields' => array(AVG(Rating.value) as rating_average)
        )
)

This works for the first record returned, but subsequent records have
an empty array where the rating average should be. What's going on? Am
I doing something wrong? I get the same result no matter if its SUM,
AVG, etc...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to