Suppose you have a tblRoom and tblUserInfo. Now, you need to select all the rooms regardless of whether the room has user information or not. This calls for a LEFT JOIN which will select everything from the LEFT side (the room side) regardless of the join on the right side. Here is the example.
var list = from r in dc.tblRooms
join ui in dc.tblUserInfos
on r.UserName equals ui.UserName into userrooms
where r.CourseID == 1848
from ur in userrooms.DefaultIfEmpty()
select new
{
FirstName = (ur.FirstName == null) ? "N/A" : ur.FirstName,
LastName = (ur.LastName == null) ? "N/A" : ur.LastName,
RoomName = r.Name
};
The anonymous type replaces the "null" FirstName and LastName with "N/A" (not available).