应该是你的全文搜索创建不成功吧!
错误提示找不到与全文搜索相匹配的列,你先用一个字段来试试看
mysql>create fulltext index ftitle on jgdmaterial (title);
错误提示找不到与全文搜索相匹配的列,你先用一个字段来试试看
mysql>create fulltext index ftitle on jgdmaterial (title);
解决方案 »
- MySQL Connector/Net 5.1.3 客户端读读出来的数据都是乱码,试尽了一下方法都无法解决,那位大虾可以帮忙??
- 求一个sql语句写法
- 菜鸟送分题:请问怎么写这个sql语句?
- 刚刚接触mysql问一个小问题马上给分
- 一个关于MYSQL的较复杂的查询语句.
- 用MySQL怎么创建数据库?
- PB 中取 MySql 记录数问题,急等回复!!!
- mysql中如何给记录上锁
- 谁来帮帮我~~??????????????????????????????
- 关于sql的查询 及 书籍推荐 ???
- MYSQL怎么实现记录锁?请高手帮忙,高分
- 想读MYSQL 的源代码, 各位同仁有没有好的建议或者指导资料?
只要你把
select id from jgdmaterial where match (title) against ('material');
改成
select id from jgdmaterial where match (title,author) against ('material');
就行了。
以下是我所做的试验
mysql> CREATE TABLE articles (
-> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-> title VARCHAR(200),
-> body TEXT,
-> FULLTEXT (title,body)
-> );
Query OK, 0 rows affected (0.12 sec)mysql> INSERT INTO articles VALUES
-> (NULL,'MySQL Tutorial', 'DBMS stands for DataBase ...'),
-> (NULL,'How To Use MySQL Efficiently', 'After you went through a ...'),
-> (NULL,'Optimising MySQL','In this tutorial we will show ...'),
-> (NULL,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-> (NULL,'MySQL vs. YourSQL', 'In the following database comparison ...'),
-> (NULL,'MySQL Security', 'When configured properly, MySQL ...')
-> ;
Query OK, 6 rows affected (0.02 sec)
Records: 6 Duplicates: 0 Warnings: 0mysql> select * from articles;
+----+------------------------------+------------------------------------------+| id | title | body |+----+------------------------------+------------------------------------------+| 1 | MySQL Tutorial | DBMS stands for DataBase ... || 2 | How To Use MySQL Efficiently | After you went through a ... || 3 | Optimising MySQL | In this tutorial we will show ... || 4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ... || 5 | MySQL vs. YourSQL | In the following database comparison ... || 6 | MySQL Security | When configured properly, MySQL ... |+----+------------------------------+------------------------------------------+6 rows in set (0.00 sec)mysql> SELECT * FROM articles
-> WHERE MATCH (title,body) AGAINST ('database');
+----+-------------------+------------------------------------------+
| id | title | body |
+----+-------------------+------------------------------------------+
| 5 | MySQL vs. YourSQL | In the following database comparison ... |
| 1 | MySQL Tutorial | DBMS stands for DataBase ... |
+----+-------------------+------------------------------------------+
2 rows in set (0.04 sec)mysql> SELECT * FROM articles
-> WHERE MATCH (title) AGAINST ('database');
ERROR 1191 (HY000): Can't find FULLTEXT index matching the column list
这个全文索引可能不像MSSQL一样,做一个索引就可以了,如果分开检不同字段的话,是不是就得创建多个?
create fulltext index f_title on jgdmaterial (title);
create fulltext index f_author on jgdmaterial (author);select count(*) from jgdmaterial where match (title) against ('material');
select count(*) from jgdmaterial where match (author) against ('david');试试,可能是这样。