开发过程中碰到一个关于mysql 全文检索的问题,控制台打印的SQL语句拿到数据库里执行,结果不对。后来发现原来是少了双引号。下面是网上找到的资料,我是看到这个才意识到自己的问题。
这是之前在数据库执行的SQL语句,检索结果上万条。
SELECT DISTINCT c.Rm_Code, c.Tsr_Code, c.TradeName, c.Location, c.Tel_Number, c.Url, c.Nss_category1, c.Nss_category2 FROM CompanyMst c INNER JOIN Tradename_keyword t ON t.rm_code = c.rm_code WHERE c.Show_flag = 0 AND MATCH(t.keyword_unicode)AGAINST( ‘30d1 30bd 30ca ‘ IN BOOLEAN MODE ) ORDER BY LstEntDtm DESC, Rm_Code ASC
这是之后改正后在数据库执行的SQL语句,检索结果11条。
SELECT DISTINCT c.Rm_Code, c.Tsr_Code, c.TradeName, c.Location, c.Tel_Number, c.Url, c.Nss_category1, c.Nss_category2 FROM CompanyMst c INNER JOIN Tradename_keyword t ON t.rm_code = c.rm_code WHERE c.Show_flag = 0 AND MATCH(t.keyword_unicode)AGAINST( ‘"30d1 30bd 30ca "‘ IN BOOLEAN MODE ) ORDER BY LstEntDtm DESC, Rm_Code ASC
时间: 2024-11-10 12:15:47