On Mar 1, 5:26 am, LeonS [email protected] wrote:
I want to generate a query with conditions like that
:conditions => [“score_team_1 ? score_team_2”, compare_sign] .
The resulting query ends e.g. with score_team_1 ‘=’ score_team_2
How can i remove the apostrophes from include into the string?
You could also consider switching the way the condition is defined:
score_team_1 < score_team_2
is equivalent to:
score_team_1 - score_team_2 < 0
which (on MySQL - check your DB for details) is equivalent to:
SIGN(score_team_1 - score_team_2) = -1
The last form is handy, as the number at the end controls whether you
end up with < or >.
No idea if the different queries might have different performance -
try it and see, if it’s an issue.