mysql全文搜索...
时间:2010-08-13 来源:garcon1986
/*************by garcon1986********************/
create database testDB: use testDB; create table testTable( pk_tId int auto_increment not null, firstName varchar(20), lastName varchar(20), age int, details text, primary key(pk_tId), unique id(pk_tId), fulltext(firstName, lastName, details) ); insert into testTable values(0, 'Mitchell', 'Harper', 20, 'Mitchell is the founder and manager of devArticles and various other sites across the SiteCubed network'); insert into testTable values(1, 'Ben', 'Rowe', 19, 'Ben is our Flash guru. He is currently writing a series of Flash articles that show beginners how to use Flash to create dynamic content with PHP'); insert into testTable values(2, 'Havard', 'Lindset', 19, 'Havard is a PHP and MySQL power user'); insert into testTable values(3, 'Michael', 'Manatissian', 25, 'Michael is the senior devArticles editor and is a capable Linux/Apache administrator'); insert into testTable values(4, 'Sandra', 'Lee', 23, 'Sandra is our finance and accounting wizard, having 4 years of experience under her belt'); SELECT * FROM testtable WHERE MATCH ( firstName, lastName, details ) AGAINST ( 'founder' );