我在SQL Server 2008中有这个查询
SELECT TOP 1000 *
FROM Quotes
INNER JOIN QuoteImages ON Quotes.Id = QuoteImages.QuoteId
WHERE FREETEXT(QuoteText,'some text')
如何按最相关或最高级别排序结果?
我已经阅读了msdn文档,但它似乎很复杂,我不知道如何创建复杂的存储过程。
答案 0 :(得分:12)
您应该使用FREETEXTTABLE
(link)代替FREETEXT
:
SELECT TOP 1000 Q.*, QI.*
FROM Quotes Q
INNER JOIN QuoteImages QI
ON Q.Id = QI.QuoteId
INNER JOIN FREETEXTTABLE(Quotes,QuoteText,'some text') FT
ON Q.Id = FT.[Key]
ORDER BY RANK DESC