If you are looking to match EXACT words then don't use LIKE keyword.
Y
ou could do word boundaries with the following REGEXP.
SELECT * FROM TABLE WHERE field_name RLIKE "[[:<:]]foo[[:>:]]";
In Ruby code you can use it like
Model.find(:all, :conditions => "field_name RLIKE '
foo
.*'")or
Model.find(:all, :conditions => "field_name REGEXP 'foo.*'")
No comments:
Post a Comment