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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:41:05+00:00 2026-05-27T13:41:05+00:00

I have three entities as shown below. Student { StudentID, Name, Age } Parent

  • 0

I have three entities as shown below.

Student { StudentID, Name, Age } 

Parent { ParentID, Name, Age } 

StudentParent { StudentParentID, StudentID, ParentID }

I need to get an IQueryable list of students that are a certain age and have no parents. I am currently using the following code which does work.

IQueryable<Student> Student s = from s in db.Students
                                 where s.Age == 18
                                 where !(from sp in db.StudentParent where sp.StudentID == s.StudentID select sp.StudentID).Contains(s.StudentID)
                                 select s;

I would just like help converting this to a Lambda expression.

  • 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-27T13:41:06+00:00Added an answer on May 27, 2026 at 1:41 pm

    This should work:

    db.Students.Where( s =>
        s.Age == 18 &&  db.StudentParent.All(sp => sp.StudentID != s.StudentID)
    );
    

    Edit: This assumes that you do not have a link from students to parents; if you do, use it instead of a join for better readability.

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

Sidebar

Related Questions

I have three entities: Country, State and City with the following relationships: When creating
I have three entities: EntityA, EntityB and EntityC connected with to-many relationships. See schema
I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
I have a case where i have three entities with one-to-many and one-to-many relationships:
I have three entities, ChannelEntity -> MatchChannelEntity <- MatchEntity, the MatchChannelEntity saves the many
So I've got some data. There are entities. Entities have an arbitrary number of
I have container of geometrical entities. Let's assume there is circle, ellipse, line, arc.
I have 2 Entities, related by a many-to-many relationship. Thing<<->>Tag There is one NSArrayController
Have three classes User, Group and Field. Many to many relationship on User /
Have three divs in a container that I want to float over a large

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.