用的sql为:select match (name1) against ("cd2002") from table_name where name1='cd2002';
得到的结果为
+-------------------------------------+
| match (name1) against ("cd2002") |
+-------------------------------------+
| 0 |
| 0 |
+-------------------------------------+
2 rows in set
不知道哪位能解释一下哪里出错了,在线等,谢谢!
得到的结果为
+-------------------------------------+
| match (name1) against ("cd2002") |
+-------------------------------------+
| 0 |
| 0 |
+-------------------------------------+
2 rows in set
不知道哪位能解释一下哪里出错了,在线等,谢谢!
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)
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)
show variables like 'char%';
change the sql like this:select name1 from table_name where mathch(name1) aganist('cd2002') and name1='cd2002';
`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;