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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:08:04+00:00 2026-05-27T05:08:04+00:00

I have several tables that are properly linked and mapped through FKs / link

  • 0

I have several tables that are properly linked and mapped through FKs / link tables.

ie: link_table -> 1 to many relationship to table_one and table_two -> many to many relationship to table_three

var results = db.link_table.Where(l => l.table_one.RandomProperty == "value");

The above obviously works but I want to be able to make a select like this:

var results = db.link_table.Where(l => l.table_one.RandomProperty == "value" && l.table_two.table_three.RandomProperty == "anothervalue");

This fails because it seems not possible to access the properties that belong to table_three. The SQL query I would like should resemble something like this (the WHERE part is the most important):

SELECT * FROM link_table
LEFT JOIN table_one ON table_one.assoc = link_table.assoc
LEFT JOIN table_two ON table_two.assoc = link_table.assoc
LEFT JOIN table_three ON table_two.assoc = table_three.assoc
WHERE table_one.RandomProperty = "value" AND table_three.RandomProperty = "AnotherValue"

How would I be able to access the “RandomProperty” of table_three through the relational mapping of Linq2Entities? Is it even possible in one single line of code and thus getting the result I want in one automatically generated SQL query?

  • 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-27T05:08:05+00:00Added an answer on May 27, 2026 at 5:08 am

    The in-depth answer is given to this question: linq to entities, a where in where clause? (inner where). It involves using the .Any() command to search through the related many-to-many table data.

    i.e.:

    var results = db.link_table.Where(l => l.table_one.RandomProperty == "value" && l.table_two.table_three.Any(t => t.RandomProperty == "value"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several tables that I am selecting data from. I am trying to
I have several tables that I want to put side by side, however when
I have several database tables that just contain a single column and very few
I have a function that updates several tables. As an example, let's say it
I have a data-upload function that load some data into several tables and processes
I have an Excel Workbook that has several worksheets in it. The tables in
I have a mysql table that have several records linked to one particular tag.
I have a SQLite database, and several tables within that datbase. I am developing
I'm using Castle ActiveRecord in a warehouse project. I have several tables that get
In my DB schema I have several tables that will be related to a

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.