Hi all ...
The following FTS SQL returns the results i need but the order of the results does not reflect the order of the sub-select statement results. How can i return the results in the exact order returned by the sub-select statment?
For example as it currently stands if the sub-select returns the IDs of (12, 5, 3, 8, 1) the final recordset will ignore that order and return the records in the order of (1, 3, 5, 8, 12).
SELECT l.ItemID, l.Name, l.CategoryID, l.SubCategoryID, l.FileName, c.Category, s.SubCategory
FROM tblSubCategories AS s
INNER JOIN tblLibraryItems AS l ON s.SubCategoryID = l.SubCategoryID
INNER JOIN tblCategories AS c ON l.CategoryID = c.CategoryID
WHERE l.ItemID IN
SELECT TOP 100 tblKeywordMatches.ItemID
INNER JOIN FREETEXTTABLE(tblKeywords, Keyword, @SearchQuery) AS ft
ON tblKeywordMatches.KeywordID = ft.[KEY]
ORDER BY ft.Rank DESC
Can anyone help? :)
Or alternatively can anyone think of a better way of doing this query?
Many thanks ...