Linq – Left Join with VB.Net

Imagine you have to make a left join between the user table and the jobs table, where there may be no items related to the user table in the jobs table.

Dim users = From u In db.Users
            From j In db.Jobs.Where(Function(x) x.UserId = u.Id).DefaultIfEmpty()                        
            Select u

Leave a Comment

Your email address will not be published. Required fields are marked *