开发者

MySQL query to search for MATCH in 3 columns?

开发者 https://www.devze.com 2023-03-25 17:44 出处:网络
I created a FULLTEXT Index for columns: City, Group and Text called city_group_text_comparator开发者_开发知识库

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消