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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:55:05+00:00 2026-05-26T19:55:05+00:00

I am new to LINQ and Entity Framework and I am stuck on a

  • 0

I am new to LINQ and Entity Framework and I am stuck on a particular query which I am trying to write.
I have a database with the below structure. To keep it simple, I have just included the files and fields that are relevant to the problem.

Table: SCMPOFILE
Columns: 
POKEY
PONUMBER
...


Table: SCMSKUFILE
SKUKEY
POKEY - Foreign Key on SCMPOFILE.POKEY
.....


Table: SCMSHPMAST
SHIPKEY
DELIVERYDATE
.....


Table: SCMSHIPPINGDETAIL
SHPDTLKEY
SHIPKEY  - Foreign Key on SCMSHPMAST.SHIPKEY
POKEY - Foreign Key on SCMPOFILE.POKEY
SKUKEY - Foreign Key on SCMSKUFILE.SKUKEY
......

As you can see from the structure, 1 shipment Key can have multiple shipment Detail Keys
Similarly, each PO and sku can have multiple Shipment Keys associated with it.

I am trying to find all skus (SCMSKUFILEs) where SCMSHPMAST.DELIVERYDATE is not null. As I have defined the foreign keys, the model generated automatically brings the SCMSHIPPINGDETAILs with each SCMSKUFILE associated to it (and SCMSHPMAST attached to each SCMSHIPPINGDETAIL). I can do joins on all the individual files to get my desired results, but I want to use the LINQ and the model generated by entity framework for that.

I am trying to do something like this:-
Select all SCMSKUFILEs where SCMSHIPPINGDETAILs has SCMSHPMAST having DELIVERYDATE not equal to null.

Is this something which can be done using a single LINQ query? I have scratched my head a lot but I am not able to write the LINQ query.

I hope I have explained my problem properly. Please let me know if I have missed anything?

Thanks,
Abhi.

  • 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-26T19:55:06+00:00Added an answer on May 26, 2026 at 7:55 pm

    Have you tried something like this?

    var results = SCMSKUFILEs.Where(a => a.SCMSHIPPINGDETAILs.Any(d => d.SHIPMASTs.Any(m => m.DELIVERYDATE != null)));
    

    Not sure off the top of my head if it’d work worth a damn with the nested ANY’s, but worth a try.

    You could also go from the other direction, something like this…

    var results = SHIPMASTs.Where(m => m.DELIVERYDATE != null)
        .SelectMany(m => m.SCMSHIPPINGDETAILs)
        .SelectMany(d => d.SCMSKUFILEs)
        .Distinct();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Linq using Entity Framework to query MySQL Database as below -
I am fairly new to Entity framework as well as LINQ. I have used
I have a simple LINQ query running on top of Entity Framework (v1) and
I am new to entity framework. I need to develop a Linq query based
I am still new to LINQ, and I have wrestled with a query for
I am a bit new to LINQ and to Entity Framework, so rather simple
I'm having trouble building an Entity Framework LINQ query whose select clause contains method
I am inserting a new row to the database table using Entity Framework, but
New to Linq to Entities. I am using entity framework and linq. In my
I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it)

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.