SELECT
`name`,
MATCH (`name`) AGAINST ('"gold"' IN BOOLEAN MODE) as score
FROM
foo
WHERE
group = '1'
AND MATCH (`name`) AGAINST ('"gold"' IN BOOLEAN MODE)
ORDER BY score;
返回4个结果:
name | score
----------------|--------------------
Nice Gold | 0.06243875250220299
Super Nice gold | 0.06243875250220299
Ugly gold | 0.06243875250220299
Fancy gold | 0.06243875250220299
现在,我想在score
子句中使用WHERE
别名来提高可读性,但是由于WHERE
无法识别它,因此我使用HAVING
:
SELECT
`name`,
MATCH (`name`) AGAINST ('"gold"' IN BOOLEAN MODE) as score
FROM
foo
WHERE group = '1'
HAVING score > 0
ORDER BY score;
现在,一些结果确实很奇怪:
name | score
----------------|--------------------
Nice Gold | 0.06243875250220299
Super Nice gold | 0.06243875250220299
Nice Diamond | 0
Custom | 0
Ugly gold | 0.06243875250220299
Fancy gold | 0.06243875250220299
为什么显示Nice Diamond
和Custom
?我在AWS RDS上使用Aurora MySql。