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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:14:27+00:00 2026-06-02T07:14:27+00:00

In my database field I have a Positions field, which contains a space separated

  • 0

In my database field I have a Positions field, which contains a space separated list of position codes. I need to add criteria to my query that checks if any of the locally specified position codes match at least one of the position codes in the field.

For example, I have a local list that contains "RB" and "LB". I want a record that has a Positions value of OL LB to be found, as well as records with a position value of RB OT but not records with a position value of OT OL.

With AND clauses I can do this easily via

foreach (var str in localPositionList)
    query = query.Where(x => x.Position.Contains(str);

However, I need this to be chained together as or clauses. If I wasn’t dealing with Linq-to-sql (all normal collections) I could do this with

query = query.Where(x => x.Positions.Split(' ').Any(y => localPositionList.contains(y)));

However, this does not work with Linq-to-sql as an exception occurs due it not being able to translate split into SQL.

Is there any way to accomplish this?

I am trying to resist splitting this data out of this table and into other tables, as the sole purpose of this table is to give an optimized “cache” of data that requires the minimum amount of tables in order to get search results (eventually we will be moving this part to Solr, but that’s not feasible at the moment due to the schedule).

  • 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-02T07:14:28+00:00Added an answer on June 2, 2026 at 7:14 am

    I was able to get a test version working by using separate queries and running a Union on the result. My code is rough, since I was just hacking, but here it is…

            List<string> db = new List<string>() {
                "RB OL",
                "OT LB",
                "OT OL"
            };
    
            List<string> tests = new List<string> {
                "RB", "LB", "OT"
            };
    
            IEnumerable<string> result = db.Where(d => d.Contains("RB"));
    
            for (int i = 1; i < tests.Count(); i++) {
                string val = tests[i];
                result = result.Union(db.Where(d => d.Contains(val)));
            }
    
            result.ToList().ForEach(r => Console.WriteLine(r));
    
            Console.ReadLine();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field in my database that contain comma separated values these values
I have a database table with a field that I need to read from
I have a varchar field in my database which i use for two significantly
I have an application using a MySql database which is displaying a paginated list
I have a database field where I want to store my password. In a
I have one field in Database ( Sql Server DB 2000) with varchar field
I have Database with date field. I see the time like: 1900-01-01 13:38:00.000 How
In the database I have a field with a .mht file. I want to
I have little doubt, I have a field of type oid in my database
say i have a nvarchar field in my database that looks like this 1,

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.