Created
November 25, 2014 15:16
-
-
Save SergioGeeK7/8e89ab43f0791c645cf7 to your computer and use it in GitHub Desktop.
From http://stackoverflow.com/questions/1122942/linq-to-sql-left-outer-join-with-multiple-join-conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from p in context.Periods | |
join f in context.Facts | |
on new { | |
id = p.periodid, | |
p.otherid | |
} equals new { | |
f.id, | |
f.otherid | |
} into fg | |
from fgi in fg.DefaultIfEmpty() | |
where p.companyid == 100 | |
select f.value | |
from p in context.Periods | |
join f in context.Facts on p.id equals f.periodid into fg | |
from fgi in fg.Where(f => f.otherid == 17).DefaultIfEmpty() | |
where p.companyid == 100 | |
select f.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment