包含不在mysql中工作

时间:2013-03-15 15:26:23

标签: mysql

我正在使用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

3 个答案:

答案 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;