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;
returns 4 results :
name | score
----------------|--------------------
Nice Gold | 0.06243875250220299
Super Nice gold | 0.06243875250220299
Ugly gold | 0.06243875250220299
Fancy gold | 0.06243875250220299
Now I would like to use the score
alias in the WHERE
clause to increase readability, but as it's not recognized by WHERE
, I'm using HAVING
like :
SELECT
`name`,
MATCH (`name`) AGAINST ('"gold"' IN BOOLEAN MODE) as score
FROM
foo
WHERE group = '1'
HAVING score > 0
ORDER BY score;
and now, some results are really weird :
name | score
----------------|--------------------
Nice Gold | 0.06243875250220299
Super Nice gold | 0.06243875250220299
Nice Diamond | 0
Custom | 0
Ugly gold | 0.06243875250220299
Fancy gold | 0.06243875250220299
Why are Nice Diamond
and Custom
displayed ? I'm using Aurora MySql on AWS RDS.