Re: Getting "max" of contained records

2009-02-20 Thread Al
Thanks guys, I'm using that userID just for testing purposes. The syntax effort did not work and the find(first) workaround wouldn't apply in this situation, but you did get me to where I needed to go. I ordered the PhdCOllege model by 'dateleft DESC' so that the most recent college is listed fi

Re: Getting "max" of contained records

2009-02-20 Thread brian
On Fri, Feb 20, 2009 at 10:42 AM, Al wrote: > > Hello, can someone tell me if this is possible? I have the following > Model association: > > PhdUser hasOne PhdApplication > PhdApplication hasMany PhdCollege > > So a user inputs multiple colleges for their application, and I want > to query for o

Re: Getting "max" of contained records

2009-02-20 Thread Stu
I think it might be Syntax, try: $query = $this->PhdUser->find('all', array( 'contain'=>array( 'PhdCollege'=>array('dateLeft' => 'max(dateLeft)'), 'PhdApplication'=>array('userID' => '"6240"'), 'PhdTest' ), A work around met

Re: Getting "max" of contained records

2009-02-20 Thread Al
I went back and tried to rebind the PhdCollege model with specific params, but it looks like I can't use GROUP BY conditions and therefore cannot use 'MAX'. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" gr

Getting "max" of contained records

2009-02-20 Thread Al
Hello, can someone tell me if this is possible? I have the following Model association: PhdUser hasOne PhdApplication PhdApplication hasMany PhdCollege So a user inputs multiple colleges for their application, and I want to query for only the most recent college (dateLeft). I've just started un