此時此查詢將搜索名爲article的表,其中的標題和摘要字段包含特定關鍵字。它返回的集合是標題和摘要包含關鍵字的文章,但是我想對其進行更改,以便返回標題或文章的摘要包含關鍵字。我怎麼做到這一點?通過簡單地將內部連接更改爲外部連接?我該如何從執行AND操作切換到OR?
BEGIN
with articlesearch as (
SELECT top 1000 FT_TBL.articleID, FT_TBL.title,FT_TBL.abstract,FT_TBL.publicationdate,
(select j.journalID from journal j where FT_TBL.journalID=j.journalID) as sourceID,
(select j.journalname from journal j where FT_TBL.journalID=j.journalID) as sourcename,
(select j2.medabbr from journal j2 where FT_TBL.journalID=j2.journalID) as medabbr,
(select j1.impactfactor from journal j1 where FT_TBL.journalID=j1.journalID) as impactfactor,
KEY_TBL.RANK,
ROW_NUMBER() OVER (ORDER BY KEY_TBL.RANK desc) AS RowNumber
FROM article AS FT_TBL
INNER JOIN
CONTAINSTABLE(article,title,@keyword) AS KEY_TBL
ON FT_TBL.articleID = KEY_TBL.[KEY]
INNER JOIN
CONTAINSTABLE(article,abstract,@keyword) AS KEY_TBL2
ON FT_TBL.articleID = KEY_TBL2.[KEY]
where FT_TBL.inactive=0
ORDER BY RANK DESC
)
SELECT articleID, sourcename,title,abstract,publicationdate,medabbr
FROM articlesearch
WHERE RowNumber BETWEEN @RowStart AND @RowEnd ORDER BY publicationdate desc;
END
「left outer join JOIN」是一個錯字嗎? – xxyyxx
看起來像是一個錯字。 –