What fields do you have in the Count table?  When I get this error it
is because the join was incorrect - usually. Also - when the errors
occur, usually there is a code and a context link that will show you
more of the dump when clicked on and what the conflicting code is.  It
should have also printed out the sql query at the top and you can see
the exact query and troubleshoot from there.

On Aug 17, 6:07 am, Okalany Daniel <[email protected]> wrote:
> the model Place hasMany Count, and Count belongs to place.
> So using the Containable behaviour, i can specify conditions for child
> fields like:
>
> $this->Place->Behaviors->attach('Containable');
>         $this->paginate['Place'] = array(
>             'contain' => array('Count'=>array(
>                 'conditions'=>array('Count.date'=>date('Y-m-d'))
>             )),
>         //'order' => 'Count.count DESC'
>         );
>         $places = $this->paginate('Place');
>
> But i'd like to order the parent Model by a field in a child model. When i
> uncomment the line that starts 'order', i get the error:
> SQL Error: 1054: Unknown column 'Count.count' in 'order clause'
>
> Thanks in advance.
>
>
>
>
>
> On Tue, Aug 17, 2010 at 10:28 AM, AD7six <[email protected]> wrote:
>
> > On Aug 16, 5:25 pm, Okalany Daniel <[email protected]> wrote:
> > > Hi, Andy Dawson,
> > > i'm having a similar problem,
>
> > How similar is your sql error or code ? I find it hard to compare to
> > things I can't see :).
>
> > > but i don't understand your fix.
>
> > I didn't get as far as to propose a fix. However I'll give you this
> > hint: the book almost certainly has a relevant example and hasMany/
> > hasAndBelongsToMany don't generate joins in the main query - hasOnes
> > do.
>
> > AD
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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]<cake-php%[email protected] 
> > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> --
> OKALANY DANIEL,
> P.O BOX 26150,
> Kampala.,
> Uganda.http://okasoft.net
> --
> When confronted by our worst nightmares, the choices are few; Fight or
> flight. We hope to find the strength to stand against our fears but
> sometimes, despite ourselves, we run. What if the nightmare gives chase?
> Where can we hide then?

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