0

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

3 回答 3

1

我相信 contains 主要用于 Xpath/Xquery。mysql 中一个类似的函数是 INSTR()。使用它的正确代码是:

    select * from MUTHU
    where INSTR(MY, 'how') > 0;
于 2013-03-15T15:52:34.167 回答
1

我不认为 MYSQL 有一个名为 的函数CONTAINS,请尝试以下查询:

SELECT * FROM MUTHU
WHERE MY LIKE '%how%';
于 2013-03-15T15:42:55.027 回答
0

你错过了Where条件,

尝试这个:

SELECT * FROM MUTHU
Where MY CONTAINS ( MY,"how" );
于 2013-03-15T15:38:51.603 回答