开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜