Hi,

I'm siting here for about 2 hours and get it not work. I need a simple
group by in an association.



This is in my controller:


$this->Hotel->bindModel(
       array('hasMany' =>
                array(
                        'HotelDescriptionTranslation' => array(
                                                        'className' =>
'HotelDescriptionTranslation',
                                                        'foreignKey' => 
'hotel_id',
                                                        'conditions' => $cond1
                                                                                
),
                        'HotelDescriptionPhoto' => array(
                                                    'className' => 
'HotelDescriptionPhoto',
                                                'foreignKey' => 'hotel_id',
                                                'conditions' =>
$cond2                                                                          
                                                                 )
                                                                )
                        ), FALSE
            );
$hotel = $this->Hotel->findByHotelId($hotel_id);



Results in this query:

SELECT `HotelDescriptionPhoto`.`id`,
`HotelDescriptionPhoto`.`descriptiontype_id`,
`HotelDescriptionPhoto`.`hotel_id`,
`HotelDescriptionPhoto`.`photo_id`,
`HotelDescriptionPhoto`.`url_max300`,
`HotelDescriptionPhoto`.`url_original`,
`HotelDescriptionPhoto`.`url_square60`,
`HotelDescriptionPhoto`.`created`, `HotelDescriptionPhoto`.`modified`
FROM `hotel_description_photos` AS `HotelDescriptionPhoto` WHERE
(descriptiontype_id = '5' OR descriptiontype_id = '10') AND
`HotelDescriptionPhoto`.`hotel_id` IN (60160)



But I need a "GROUP BY `HotelDescriptionPhoto`.`photo_id`" inside the
query...

Is there an easy(?!) way to achieve this? (I would not want to create
a custom query)...

Regards,
Alexander


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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