mysql_query("SELECT a.about,b.title,b.article,b.description
FROM about a
JOIN articles b ON b.user_id=a.user_id
WHERE MATCH(b.title,b.article) AGAINST ('$search')
");
这会产生错误“无法找到与列列表匹配的FULLTEXT索引”
但其中任何一个都可行......
mysql_query("SELECT a.about,b.title,b.article,b.description
FROM about a
JOIN articles b ON b.user_id=a.user_id
WHERE MATCH(b.title) AGAINST ('$search')
");
mysql_query("SELECT a.about,b.title,b.article,b.description
FROM about a
JOIN articles b ON b.user_id=a.user_id
WHERE MATCH(b.article) AGAINST ('$search')
");
在已声明的所有列上激活文本索引。
答案 0 :(得分:1)
b.title,b.article
上没有FULLTEXT索引。
将您的查询用作
mysql_query("SELECT a.about,b.title,b.article,b.description
FROM about a
JOIN articles b ON b.user_id=a.user_id
WHERE MATCH(b.title) AGAINST ('$search')
and
MATCH(b.article) AGAINST ('$search')
");
或在b.title,b.article
列
CREATE FULLTEXT INDEX t_a_articles_index ON articles (title, article) ...