我有以下查询,我希望只返回与label_name“Ultra Music”匹配的记录,但是它会返回任何label_name:
SELECT `chart_rating` . * , SUM( chart_rating.rating_score ) AS total_score, release.release_label
FROM `chart_rating`
INNER JOIN `release` ON `chart_rating`.`rating_release_id` = `release`.`id`
WHERE MATCH (
release.release_label
)
AGAINST (
"Ultra Music"
IN BOOLEAN MODE
)
GROUP BY `rating_release_id`
ORDER BY `total_score` DESC
我对release_artist有一个几乎完全相同的查询,它完美无缺。
此查询有什么问题?
答案 0 :(得分:0)
您可以尝试使用Addition
Subtraction
Multiplication
Division
Exponents
Square roots
Sin
Cos
Basic Loops, Conditionals, and relational operators.
,
space
然后添加REPLACE
+UltraMusic
希望这有帮助。
答案 1 :(得分:0)
为什么不使用简单的比较。
SELECT `chart_rating` . * , SUM( chart_rating.rating_score ) AS total_score, release.release_label
FROM `chart_rating`
INNER JOIN `release` ON `chart_rating`.`rating_release_id` = `release`.`id`
WHERE release.release_label = "Ultra Music"
GROUP BY `rating_release_id`
ORDER BY `total_score` DESC
如果您确实需要全文搜索,where子句可能如下所示:MATCH (release.release_label) AGAINST ("+Ultra +Music" IN BOOLEAN MODE)
答案 2 :(得分:0)
默认情况下(当既未指定+也未指定时),该单词是可选的,但包含它的行的等级更高。这模仿了没有IN BOOLEAN MODE修饰符的MATCH()... AGAINST()的行为。