I think someone may have answered this, but its better to use a column
alias in the select clause and then utilize that alias for your ordering.
An example:
select id, (count_something * 0.1) + (something_else * 0.8) as
count_order
from my_table
where blah = 'blah'
order by count_order;
This is actually a bit easier for the SQL parser to manage as well, and
if you decide to change the count_order algorithm, its in a place that
is easier to manipulate in the future. I don't know offhand if Cake will
manage this somehow with its automagic. Might be worth a try though.
Cheers,
Fred
hks wrote:
> In my query, I want to use 'order' => "( (thread.views * 0.1) +
> (thread.messages * 0.8) ) DESC"
>
> But cakephp will escape the fields and turn the number 0.1 into
> `0`.`1` causing error in SQL.
> I tried using the -! but it doesn't work.
>
> Any suggestions?
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---