Cannot use full-text search with mysql query using MATCH and AGAINST

hope someone can help me. I am trying to use the full text search MATCH and AGAINST.

I get this error

1064 - You have an error in the SQL syntax; check the manual that matches the MariaDB server version for the correct syntax to use next to ''mytable' WHERE MATCH(user) AGAINST('alex') LIMIT 0, 25'in line 1

My example:

SELECT id, user FROM 'mytable' WHERE MATCH(user) AGAINST('alex') LIMIT 0, 25
+4
source share
2 answers

You do not need to specify mytable. Docs

SELECT id, user FROM mytable WHERE MATCH(user) AGAINST('alex') LIMIT 0, 25

For the mentioned error.

ALTER TABLE mytable ADD FULLTEXT index_name(user);

The full-text index must contain exactly the same number of columns in the same order as specified in the MATCH clause.

Here for more.

+2

, , .

SELECT id, user FROM `mytable` WHERE MATCH(user) AGAINST('alex') LIMIT 0, 25

?

MYSQL, .

MYSQL

+3

Source: https://habr.com/ru/post/1628961/


All Articles