2

我的全文搜索结果有问题,我需要找到列中包含“spray”name且列中不包含“men”的description行。

select top 10 ftt.RANK, ID, name, description
from mod_product_all_fields
INNER JOIN containstable(mod_product_all_fields,(name),' ("spray") ' )  as ftt
    ON mod_product_all_fields.ID=ftt.[KEY]
INNER JOIN containstable(mod_product_all_fields,(description),' not ("men")   ')  as ftt2
    ON mod_product_all_fields.ID=ftt2.[KEY] 
ORDER BY ftt.RANK DESC 

此查询未正确执行,调试器显示“not ('men')”附近有语法错误。

如果您对我的问题有解决方案,请告诉我

谢谢

4

1 回答 1

2

扩展我对如何搜索的较早答案的指针NOT <a word>,我认为这应该可以解决问题:

select top 10 ftt.RANK, ID, name, description
from mod_product_all_fields
INNER JOIN containstable(mod_product_all_fields,(name),' ("spray") ' )  as ftt
    ON mod_product_all_fields.ID=ftt.[KEY]
LEFT JOIN containstable(mod_product_all_fields,(description),' ("men") ')  as ftt2
    ON mod_product_all_fields.ID=ftt2.[KEY] 
WHERE
    ftt2.KEY IS NULL -- Eliminate matches on "men"
ORDER BY ftt.RANK DESC 
于 2011-09-16T13:22:51.210 回答