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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:03:59+00:00 2026-05-26T11:03:59+00:00

First, about my table setup: Group: groupId – int groupName – varchar Schedule: scheduleId

  • 0

First, about my table setup:

Group:
    groupId - int
    groupName - varchar

Schedule:
    scheduleId - int
    scheduleName - varchar

Group_Schedules
    scheduleId - int/fk to Schedule
    groupId - int/fk to Group

I’m using the EF, in the above scenario, no EF entity is created to represent Group_Schedules, instead a collection is added to Group and Schedule tables representing the other end.

I need to get all groups that belong to a schedule and have my return be an IQueryable<Group>. I.e (and no, this doesn’t work because of the way EF generates the bridge table):

var g = from g in context.Groups
        where g.Group_Schedule.scheduleId = 1 // This doesn't work because Group_Schedule is a collection of Schedule
        select g;

Is there an elegant way to get the data I need?

  • 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-26T11:03:59+00:00Added an answer on May 26, 2026 at 11:03 am

    Both of these will return an IQueryable<Group>:

    var groups = from g in db.Groups
                 where g.Schedules.Any(s => s.scheduleId == 1)
                 select g;
    
    var groups = (from s in db.Schedules
                  where s.scheduleId == 1
                  select s.Groups).SelectMany(g => g);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, let's define a few tables: Users table will store information about
First, the setup: I have a table in an Oracle10g database with spatial columns.
I remember first learning about vectors in the STL and after some time, I
When I first heard about StackOverflow, and heard that it was being built in
Referring to the first answer about python's bound and unbound methods here, I have
nobody loved my first question about this: Creating Entity Framework objects with Unity for
First a bit about the environment: We use a program called Clearview to manage
When I first started reading about and learning ruby, I read something about the
When I first started reading about Python, all of the tutorials have you use
first of all this is my third question about web services here and i

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.