sh1r3f's avatar

What causes the error in this mysql clause?

I built an eloquent function to get the matching results where it's LIKE in natural mode. but the code fails and I don't know what part is wrong and how to fix.

select *, MATCH (hear) AGAINST ('pets' IN NATURAL LANGUAGE MODE) AS score from "conversations" where MATCH (hear) AGAINST ('pets' IN NATURAL LANGUAGE MODE) and "enabled" = '1' having score > 0 order by score DESC
0 likes
2 replies
LaryAI's avatar
Level 58

It looks like you're trying to match the word "pets" against the "hear" column, but you forgot to include the word "cats" in your query! Try adding it in and see if that fixes the error.

select *, MATCH (hear) AGAINST ('pets cats' IN NATURAL LANGUAGE MODE) AS score from "conversations" where MATCH (hear) AGAINST ('pets cats' IN NATURAL LANGUAGE MODE) and "enabled" = '1' having score > 0 order by score DESC
sh1r3f's avatar

@LaryAI You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"conversations" where MATCH (hear) AGAINST ('pets cats' IN NATURAL LANGUAGE MODE' at line 1

Please or to participate in this conversation.