Thanks for the suggestion. If I do that it back-ticks the whole thing

select `x-y` AS `difference` from ...

putting spaces around the minus sign produces similar errors. Is there
a way to remove the back ticks for that field?

--Andrew

On Sep 11, 7:44 am, Rick <[email protected]> wrote:
> Assuming you don't need recursion, try it without the model names,
> i.e.
>
> 'x-y as difference'
>
> Rick
>
> On Sep 10, 5:33 pm, Andrew Koebbe <[email protected]> wrote:
>
> > I'm trying to do a simple subtraction as a field in a find statment...
>
> > ex.
>
> > $this->Model->find('all',array(
> >   'fields' => array(
> >     'Model.x - Model.y as difference'
> >   )
> > ));
>
> > but it's not parsing that correctly.
>
> > It's doing "select `Model`.`x - Model.y as difference` from ..."
>
> > Am I missing something simple here?
>
> > I know I could do the subtraction outside the query, but I want to be
> > able to order the query by the result of this subtraction.
>
> > Thanks.
> > --Andrew
>
>
--~--~---------~--~----~------------~-------~--~----~
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