Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:40:43+00:00 2026-06-14T17:40:43+00:00

Right now this query searches a table called article for entries who’s title and

  • 0

Right now this query searches a table called article for entries who’s title and abstract field’s contain a certain keyword. The set it returns are articles who’s title AND abstract contain the keyword, but I would like to change it so it returns articles who’s title OR abstract contains the keyword. How would I accomplish this? By simply changing the inner joins to an outer?

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 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:40:45+00:00Added an answer on June 14, 2026 at 5:40 pm

    The following version changes the inner joins to left outer joins and adds a where clause to get what you want:

    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 
        left outer JOIN 
            CONTAINSTABLE(article,title,@keyword) AS KEY_TBL
            ON FT_TBL.articleID = KEY_TBL.[KEY]
        left outer join 
            CONTAINSTABLE(article,abstract,@keyword) AS KEY_TBL2
            ON FT_TBL.articleID = KEY_TBL2.[KEY]
    where FT_TBL.inactive=0 and (key_tbl.[key] is not null or key_tbl2.[key] is not null)
    ORDER BY RANK DESC
    )
    
    SELECT articleID, sourcename,title,abstract,publicationdate,medabbr  
    FROM articlesearch
    WHERE RowNumber BETWEEN @RowStart AND @RowEnd ORDER BY publicationdate desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have this SQL query which is valid but always times out:
So right now I'm using this query: select * from items where mydate =
I have a database with ~100,000 entries - right now my query looks like
So, the query I'm trying to make looks like this right now: SELECT `jid`,
I'm trying to make Gzip compression work on xampp, right now this is in
I have this right now: <%= f.select :credit, (0..500) %> This will result in
I'm learning this right now so the questions might be a little juvenile. Here's
Here is the thing. Right now I have this e-commerce web site where people
Right now when I run this it keeps clicking on the same button every
Right now I can use this URL to request a Google Static Maps image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.