Change query to use a LEFT join
Posted
by
Craig
on Stack Overflow
See other posts from Stack Overflow
or by Craig
Published on 2012-10-22T04:58:04Z
Indexed on
2012/10/22
5:00 UTC
Read the original article
Hit count: 98
LINQ
I have a query which is failing, as it needs to be using LEFT JOIN, as opposed to the default INNER JOIN used by the 'join' syntax:
var users = (from u in this._context.Users
join p in this._context.Profiles on u.ProfileID equals p.ID
join vw in this._context.vw_Contacts on u.ContactID equals vw.ID
orderby u.Code
select new { ID = u.ID, profileId = p.ID, u.ContactID, u.Code, u.UserName, vw.FileAs, p.Name, u.LastLogout, u.Inactive, u.Disabled }).ToList();
How would i re-write this so that is utilises a LEFT join?
© Stack Overflow or respective owner