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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:42:33+00:00 2026-06-16T15:42:33+00:00

I have tried several things but it does not work. Basically, I want to

  • 0

I have tried several things but it does not work. Basically, I want to add nested query on EF MVC3.

SQL Query:

select * from Book where Book_PK in ( select Book_Ref from Library
where Library_Ref=’18bd9526-f3e9-4d5b-86cd-ccfea64b6f7b’ )

Book_PK is primary key of Book
Book_ref is foreign key to Book

Library_Ref is just attribute to filter the Book_ref

I have 2 tables: Book and Library which are connected through foreign key.

I only have one input, which is id, but this is not the primary key of Library.
I have tried:

`
School.Models.Entities.SchoolAll db = new Models.Entities.SchoolAll(); // db consists whole database

var temp = db.Books.Where(e => e.Book_PK.Contains(db.Libraries.Where(f => f.Library_Ref == id))).ToList();
// where id is one of the field of Library`

each Library entity may have one or may Book entity. So, the result of the query is supposed to be as list. I need to save this list into one variable. Can anyone help me?

  • 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-16T15:42:35+00:00Added an answer on June 16, 2026 at 3:42 pm

    Successfully done, converting below query:

    select * from Book where Book_PK in ( select Book_Ref from Library
    where Library_Ref=’18bd9526-f3e9-4d5b-86cd-ccfea64b6f7b’ )

    Into below entity framework:

    db.Books.Where(y => y.Libraries.Any(r => r.Library_Ref ==
    id)).ToList()

    Thanks stackoverflow

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

Sidebar

Related Questions

I have tried several things but I can't get the MySQL query in my
Here is what I have. I have tried several things but I can't figure
I have tried several things so far, but I haven't had much luck yet.
I have tried several of the solutions I have seen out here, but am
I have tried several mySQL queries to compare a column of dates stored as
I have tried several ways to login to a website through java. I have
I am stumped by this one. I have tried several angles and some come
I really need advice on how to do the following. I have tried several
I am trying to load a URLRequest in UIWebview. I have tried with several
I have tried looking though several of the already asked question about this topic

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.