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 7770487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:25:17+00:00 2026-06-01T16:25:17+00:00

I have a many-to-many relationship between a list of codes and a main table

  • 0

I have a many-to-many relationship between a list of codes and a main table with information pertinent to people on it. There are several different codes with different text values that are all variations of the same thing. I want to check if ANY of them are present. My method of doing this is going to be using LIKE%what i'm looking for%. I want to update a binary value in my main table based on the fact that a certain string is present in one of my other tables.
enter image description here

Here’s the query insofar as I can solve it without messing anything up.

UPDATE tblVisits
SET variableOfInterest=1
FROM tblVisits INNER JOIN
icd_jxn ON tblVisits.kha_id = icd_jxn.kha_id INNER JOIN
tblICD on icd_jxn.icd_fk=tblICD.ICD_ID
WHERE (tblICD.Descrip LIKE N'%text of interest%')

Since there are so many different codes that share the common attribute of having a certain string of text in their descriptions, I felt like this would be the best way to go about it instead of using a ton of OR statements. This is an older schema before I decided to add my ‘variableofInterest’ in tblVisits.

  • 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-01T16:25:18+00:00Added an answer on June 1, 2026 at 4:25 pm

    You could rewrite it with EXISTS:

    UPDATE tblVisits
    SET variableOfInterest = 1
    FROM tblVisits 
    WHERE EXISTS
          ( SELECT *
            FROM icd_jxn 
              INNER JOIN tblICD 
                ON icd_jxn.icd_fk = tblICD.ICD_ID
            WHERE tblICD.Descrip LIKE N'%text of interest%'
              AND tblVisits.kha_id = icd_jxn.kha_id
          )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a many-to-many relationship between users and groups and I have a table
I have a many-to-many relationship defined between two entities using an association table and
I have entities Post and Tag , where there is a many-to-many relationship between
I have a one to many relationship between two tables. The many table contains
I have a many-to-many relationship between two tables, let's say Friends and Foods. If
I have a many-to-many relationship between User s and Task s. I want the
Is it possible to have a many to many relationship between two tables, and
I have a one-to-many relationship between two classes for this situation. I have a
I have a one-to-many relationship between Foo and Bar and I cannot perform an
android noob... I have two tables, with a one to many relationship between country_tbl

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.