我有3张桌子,
> tblBook(BookID,ISBN,标题,摘要)
> tblAuthor(AuthorID,FullName)
> tblBookAuthor(BookAuthorID,BookID,AuthorID)
tblBookAuthor允许一本书有多个作者,作者可能已经写了任意数量的书.
SET @Word = 'FORMSOF(INFLECTIONAL,"' + @Word + '")' SELECT COALESCE(ISBNResults.[KEY],TitleResults.[KEY],SummaryResults.[KEY]) AS [KEY],ISNULL(ISBNResults.Rank,0) * 3 + ISNULL(TitleResults.Rank,0) * 2 + ISNULL(SummaryResults.Rank,0) AS Rank FROM CONTAINSTABLE(tblBook,@Word,LANGUAGE 'English') AS ISBNResults FULL OUTER JOIN CONTAINSTABLE(tblBook,Title,LANGUAGE 'English') AS TitleResults ON ISBNResults.[KEY] = TitleResults.[KEY] FULL OUTER JOIN CONTAINSTABLE(tblBook,Summary,LANGUAGE 'English') AS SummaryResults ON ISBNResults.[KEY] = SummaryResults.[KEY]
上面的代码适用于只搜索tblBook表.但是现在我想根据搜索到的关键词搜索表tblAuthor.
你能帮我解决这个问题吗?