MySQL query to search for MATCH in 3 columns?
I created a FULLTEXT Index for columns: City, Group and Text
called city_group_text_comparator开发者_开发知识库
How do I do a simple query to look up a string on all 3?
I tried this:
$result = mysql_query("SELECT * FROM Posts WHERE MATCH (City, `Group`, Text) AGAINST ('$search') LIMIT $limit_posts OFFSET $first_post");
How does it order the results?
Thanks
My example was actually right:
Adding inverted quotes around Group did the trick:
$result = mysql_query("SELECT * FROM Posts WHERE MATCH (City, `Group`, Text) AGAINST ('$search') LIMIT $limit_posts OFFSET $first_post");
Probably it's a reserved value for MySQL, honestly don't know why, but nevertheless it works this way.
精彩评论