If you add an alias to the field list you can do this (I think, again
not tested...)

$this->paginate['fields'] = am( $this->paginate['fields'], array
( 'DAYNAME(Model.field) as `day`' ) );
$this->paginate['conditions'] = am( $this->paginate['conditions'],
array('`day`'=>'Monday' ) );

but as Martin says, the SQL produced and the SQL you where hoping for
would be very helpful.

Chris.

On Jun 2, 3:10 pm, Martin Westin <martin.westin...@gmail.com> wrote:
> You don't post any mysql error or what the query looked like (it
> usually tells you what is wrong).
> A shot in the dark but it could be this simple: array('((DAYNAME
> (Model.field)))' => 'Monday');
>
> On Jun 2, 12:46 pm, toby1kenobi <toby.math...@gmail.com> wrote:
>
> > Hi there,
>
> >   Is it possible to use MySQL's DAYNAME function in the where clause
> > of a call to 'find'? i.e. something a bit like:
>
> > $this->paginate['conditions'] = array('DAYNAME(Model.field)' =>
> > 'Monday');
>
> >   The above doesn't work (which is what I was expecting) but I haven't
> > managed to find an equivalent syntax that does.
>
> >   I'm wondering if I should pursue another route? I could put
> > something in afterFind, and test that I'm in the appropriate action as
> > detailed in this useful post, would that be the best approach?
>
> >http://teknoid.wordpress.com/2009/05/04/execute-code-in-model-callbac...
>
> >   As ever, any help is greatly appreciated.
>
> > Toby
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to