Mysql SQL-显示每行的匹配
我不确定这里出了什么问题,但是这个查询为该用户显示了“关于”和“文章”中的每个条目。我在搜索中使用了一个随机关键字,试图确保只给出一个结果,但同样的情况也会发生Mysql SQL-显示每行的匹配,mysql,sql,Mysql,Sql,我不确定这里出了什么问题,但是这个查询为该用户显示了“关于”和“文章”中的每个条目。我在搜索中使用了一个随机关键字,试图确保只给出一个结果,但同样的情况也会发生 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(a.about) AGAINST ('$search') OR MATCH(
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(a.about) AGAINST ('$search')
OR
MATCH(b.title,b.article,b.description) AGAINST ('$search')
)
AND a.user_id='$user_id'
");
问题的症结所在
可以提供有关以不同方式使用MATCH
的更多信息
在“关于”和“标题文章说明”中单独搜索
SELECT a.about,null title,null article ,null description
FROM about a
WHERE
(
MATCH(a.about) AGAINST ('BNMV' IN BOOLEAN MODE)
)
AND a.user_id='1'
UNION
select null, b.title,b.article,b.description
from articles b
where
(MATCH(b.title,b.article,b.description) AGAINST ('BNMV' IN BOOLEAN MODE))
AND b.user_id='1'
重复或OP在同一查询上提出另一个问题?不,这是一个完全不同的问题,但是相同的查询。谢谢,我仍然会得到多个结果。你能显示查询结果吗?你使用的$search的值是多少?我使用了BNMV作为搜索,结果很长,所以我不能在这里发布,我只在一篇文章中添加了该关键字,这是肯定的。我编辑了我的答案。将plus simbol添加到
'+$search'
语句中。希望它能工作不幸的是,我已经创建了一个SQL小提琴-
SELECT a.about,null title,null article ,null description
FROM about a
WHERE
(
MATCH(a.about) AGAINST ('BNMV' IN BOOLEAN MODE)
)
AND a.user_id='1'
UNION
select null, b.title,b.article,b.description
from articles b
where
(MATCH(b.title,b.article,b.description) AGAINST ('BNMV' IN BOOLEAN MODE))
AND b.user_id='1'