SQL vb.net搜索术语计数或排名

时间:2012-09-04 15:31:05

标签: sql vb.net

我希望能够搜索表格以使用短语或关键字/术语,并让查询返回结果,并计算每行中使用该术语的次数,但不一定是列。我修改了我的查询,从经理工作室尝试,看看错误在哪里。我在“,”附近收到错误。但无法确定原因。谢谢你的帮助。

SELECT (KEY_TBL.[KEY], FT_TBL.title, FT_TBL.url, KEY_TBL.rank, FT_TBL.html) 
FROM content AS FT_TBL INNER JOIN FREETEXTABLE (content, html, 'income tax', 25) 
AS KEY_TBL ON FT_TBL.id = KEY_TBL.[KEY] ORDER BY KEY_TBL.Rank DESC

1 个答案:

答案 0 :(得分:0)

您应该查看FREETEXTTABLE函数,而不是FREETEXT - 这将返回匹配相关性的排名

http://msdn.microsoft.com/en-us/library/cc879245

试试这个

SELECT 
    KEY_TBL.[KEY], FT_TBL.title, FT_TBL.url, KEY_TBL.rank, FT_TBL.html
FROM content AS FT_TBL 
INNER JOIN FREETEXTTABLE (content, html, 'income tax', 25)  AS KEY_TBL 
    ON FT_TBL.id = KEY_TBL.[KEY] 
ORDER BY KEY_TBL.Rank DESC