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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:31:29+00:00 2026-05-27T02:31:29+00:00

So I have an awful query that current exists in MS Access that I

  • 0

So I have an awful query that current exists in MS Access that I am trying to rewrite in SQL Server. Basically I get data that comes from a text file that I am trying to filter down based on specific criteria.

My issues comes in with the way the data is in the text file. My table is similar to this:

Table1
BusinessDate   DateTime
Amount         money
User1          varchar
User2          varchar
User3          varchar
User4          varchar
...            varchar
User16         varchar

I have a data table that has the date and then has 16 columns with a data that has been added by a different user. There are some other fields in this table but they are unnecessary for this question.

The current query does filtering on 15 values where the userId is like something.

SELECT *
FROM Table1
WHERE (User1 Like 'AB%' Or User1 Like 'CD%' Or User1 Like 'EF%'...)
OR (User2 Like 'AB%' Or User2 Like 'CD%' Or User2 Like 'EF%'...)

What I am trying to do is store the like values in a table so I can join on them in my query. I don’t know all of the values so I need to use the wildcard because it could be any possible combination of alphanumeric characters. So I will have a table like this:

ValueTable
AB%
CD%
EF%
HI%
...

Then my query would be something similar to this but I don’t think this is possible

SELECT *
FROM Table1
WHERE User1 Like IN (SELECT Value FROM ValueTable)
OR  User2 Like IN (SELECT Value FROM ValueTable)

Is it possible to do something like this? If so, what syntax should be used because I am totally stumped.

  • 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-05-27T02:31:29+00:00Added an answer on May 27, 2026 at 2:31 am
    SELECT *
    FROM   Table1
    WHERE  EXISTS (SELECT *
                   FROM   ValueTable
                   WHERE  User1 Like Value
                           OR User2 Like Value)  
    

    Or (2008 syntax)

    SELECT *
    FROM   Table1
    WHERE  EXISTS (SELECT *
                   FROM   (VALUES(User1),
                                 (User2),
                                 (User3),
                                 (User4),
                                 /* ... */
                                 (User15),
                                 (User16) ) Users(U)
                          JOIN ValueTable
                            ON U Like Value)  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple query that runs in SQL 2008 and uses a custom
I have a CTE query that seems to be causing an awful lot of
I have an annoying SQL statement that seem simple but it looks awfull. I
Have you ever seen any of there error messages? -- SQL Server 2000 Could
(I have to deal with this awful vendor site made for IE6) I'm trying
I have a CMS with a form-module, which generates an awful markup, that makes
I have a list of words that I want to exclude from some query
I have a database full of customer data. It's so big that it's really
I have an insert query for MySQL that looks like this: INSERT INTO table
Having an awful time trying to get the accurate time for a set of

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.