0
var query = from section in load_sections.Sections
            join course in load_sections.Courses
                on section.Course_Id equals course.Course_Id
            join faculty in load_sections.Faculties
                on section.Faculty_Id equals faculty.Faculty_Id
            select section;

I have some null values in my section.Faculty_Id which will not be equal to any row in faculty.Faculty_Id and it is just returning the records where section.Faculty_Id is not null...If section.Faculty_Id is not null, then it must return the other remaining fields of Table Courses

1
  • Why do you join with faculty if you only select section? Looks like removing the join would solve your problem. Commented Apr 4, 2013 at 20:20

1 Answer 1

2

If you can't drop the join on faculty for whatever reason, you'll have to construct an outer join:

var query = from section in load_sections.Sections
            join course in load_sections.Courses
                on section.Course_Id equals course.Course_Id
            join faculty in load_sections.Faculties
                on section.Faculty_Id equals faculty.Faculty_Id into faculties
            from f in faculties.DefaultIfEmpty()
            select section;

This executes a GroupJoin with Faculties. The effect of the subsequent from f in faculties is that the grouping is flattened again by a SelectMany. .DefaultIfEmpty() creates the outer join.

Sign up to request clarification or add additional context in comments.

2 Comments

+1 I didn't realize that would have any effect. I'm still confused by this question.
@p.s.w.g Thanks. So am I. It's probably not the whole story.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.