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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:19:13+00:00 2026-05-13T10:19:13+00:00

Can I search for 1 AND 2 AND 3 without getting a false match

  • 0

Can I search for 1 AND 2 AND 3 without getting a false match because 11,22,33 are in the field?

A field that has the string = “11,22,33” should then not return any results.

  • 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-13T10:19:14+00:00Added an answer on May 13, 2026 at 10:19 am

    First of all, using comma separated values in a field is problematic, and you should consider storing them in a sepatate table instead. Then you could get the record more efficiently:

    select ...
    from mainTable t
    inner join valueTable v1 on v1.id = t.id and v1.value = 1
    inner join valueTable v2 on v2.id = t.id and v2.value = 2
    inner join valueTable v3 on v3.id = t.id and v3.value = 3
    

    If that is not possible, you have to go the slow string matching way. To match the values in a comma separated string, you can use the like operator:

    ... where
      concat(',', someField, ',') like '%,1,%' and
      concat(',', someField, ',') like '%,2,%' and
      concat(',', someField, ',') like '%,3,%'
    

    Putting the separator on both sides of the searched value makes sure that you don’t get any false positives. Adding the commas before and after the field value makes sure that you can find the first and last value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I use .NET DataSet.Select method to search records that match a DateTime?
All the examples that I can search online use the App.Config mode of specifying
How can I specify conditions in Where predicates in LINQ without getting null reference
I can search word in vim with /word . How can I search only
How can I search if a file named foo.txt was ever committed to my
How can I search for in table_a table_b table_c , which have a random
Is there a way or tool for Vista I can use to search for
Can the performance of this sequential search algorithm (taken from The Practice of Programming
I have search in MSDN and I can't figure where are the POST parameters
How can I tell unix find to include in it's recursive search a folder

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.