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

  • Home
  • SEARCH
  • 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 7069313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:25:50+00:00 2026-05-28T05:25:50+00:00

I need to create a statement in LINQ with 3 tables and OR condition.

  • 0

I need to create a statement in LINQ with 3 tables and OR condition.

My function receives an integer, lets call it intZ. I have 3 tables: tableA, tableB and tableC.

tableA has columns int1, int2 and intB. intB is related to tableB.

problem: int1 or int2 of tableA can be intZ and it has to match with one tableC record.

I need an OR condition, but I have no idea where to place it. Does it go in the where clause? Or in the equals clause?

At the moment, I know how to join 3 tables, but the condition is killing me.

What is the difference between the two ways to create statements in linq? Is there a performance impact?

edit: Okay, now I think it’s more clear. intZ has to be related with intC from tableC, and this number can be int1 or int2 of tableA.

enter image description here

  • 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-28T05:25:50+00:00Added an answer on May 28, 2026 at 5:25 am

    Just add it to a Where. In Linq2Sql this will be translated to an inner join (with or) on tableB

    from a in tableA
    from b in tableB.Where(x => x.A == a.A || x.B == a.B)
    select new { a, b };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a linq statement that combines 2 tables and send that
I have created tables in android sqlite using create statement and also inserted values
I need to create a Linq query that would have the following logic: IEnumerable<string>
UPDATED: I am using MySQL statement to create a view: I need to show
I have a dynamic SQL statement I've created in a stored procedure. I need
I'm having a problem with LINQ. I have 2 tables (Parent-child relation) Table1: Events
How to retrieve create statement for table from db in C#? I need to
Does anyone have any idea what is wrong with this create statement for mysql?
I've got two tables that need to be joined via LINQ, but they live
I have table with a name filed which is string. I need to create

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.