我正在使用CONTAINS,但它在mysql中不起作用。
mysql> SELECT * FROM MUTHU; +---------------------+ | MY | +---------------------+ | how is your studies | | how are you there | | hi there | +---------------------+ 3 rows in set (0.00 sec)
mysql> SELECT * FROM MUTHU CONTAINS ( MY, "how" );
ERROR 1064 (42000): 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 '( MY,
"how" )' at line 1
答案 0 :(得分:1)
我不认为MYSQL有一个名为CONTAINS
的函数,请尝试以下查询:
SELECT * FROM MUTHU
WHERE MY LIKE '%how%';
答案 1 :(得分:0)
您错过了Where
条件,
试试这个:
SELECT * FROM MUTHU
Where MY CONTAINS ( MY,"how" );
答案 2 :(得分:0)
我认为contains主要用于Xpath / Xquery。 mysql中的类似函数是INSTR()。正确的代码是使用它:
select * from MUTHU
where INSTR(MY, 'how') > 0;