用的sql为:select match (name1) against ("cd2002") from table_name where name1='cd2002';
得到的结果为
+-------------------------------------+
| match (name1) against ("cd2002") |
+-------------------------------------+
|                                   0 |
|                                   0 |
+-------------------------------------+
2 rows in set
不知道哪位能解释一下哪里出错了,在线等,谢谢!

解决方案 »

  1.   

    下面是参考手册上的例子程序。
    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.00 sec)
     
    mysql> INSERT INTO articles (title,body) VALUES
        -> ('MySQL Tutorial','DBMS stands for DataBase ...'),
        -> ('How To Use MySQL Well','After you went through a ...'),
        -> ('Optimizing MySQL','In this tutorial we will show ...'),
        -> ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        -> ('MySQL vs. YourSQL','In the following database comparison ...'),
        -> ('MySQL Security','When configured properly, MySQL ...');
    Query OK, 6 rows affected (0.00 sec)
    Records: 6  Duplicates: 0  Warnings: 0
     
    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.00 sec)
      

  2.   

    表什么引擎?
    mysql help:
    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.00 sec)mysql> INSERT INTO articles (title,body) VALUES
        -> ('MySQL Tutorial','DBMS stands for DataBase ...'),
        -> ('How To Use MySQL Well','After you went through a ...'),
        -> ('Optimizing MySQL','In this tutorial we will show ...'),
        -> ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        -> ('MySQL vs. YourSQL','In the following database comparison ...'),
        -> ('MySQL Security','When configured properly, MySQL ...');
    Query OK, 6 rows affected (0.00 sec)
    Records: 6  Duplicates: 0  Warnings: 0mysql> SELECT * FROM articles
        -> WHERE MATCH (title,body)
        -> AGAINST ('database' IN NATURAL LANGUAGE MODE);
    +----+-------------------+------------------------------------------+
    | id | title             | body                                     |
    +----+-------------------+------------------------------------------+
    |  5 | MySQL vs. YourSQL | In the following database comparison ... |
    |  1 | MySQL Tutorial    | DBMS stands for DataBase ...             |
    +----+-------------------+------------------------------------------+
    2 rows in set (0.00 sec)
      

  3.   

    表的name1为FULLTEXT 索引,你们贴的例子就是按照这个做的,但是就是得不到相应结果。
      

  4.   

    难道说这个FULLTEXT索引必须是两列吗?
      

  5.   

    什么字符集?
    show variables like 'char%'; 
      

  6.   

    select match (name1) against ("cd2002") from table_name where name1='cd2002';
      change the sql like this:select name1 from table_name where mathch(name1) aganist('cd2002') and name1='cd2002';
      

  7.   

    CREATE TABLE `reagents` (
      `cd_id` int(11) NOT NULL default '0',
      `projectid` varchar(30) NOT NULL default '',
      `rxnid` varchar(50) NOT NULL default '',
      `bn` varchar(20) NOT NULL,
      `reagents` varchar(255) default NULL,
      PRIMARY KEY  (`projectid`,`rxnid`,`bn`),
      KEY `cd_id` (`cd_id`),
      FULLTEXT KEY `full` (`projectid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;