I have two tables, the LP_task table and the lp_Update table . I want a complete list of tasks and only updates that have been published over a specific date range. LINQ does not seem to support any other joining criteria, but "equal" or to every task. I want all tasks (left table), even if they do not have an update. (Left Outer Join)
Dim TasksData = (From t In db.LP_Tasks _
Group Join up In db.LP_Updates On t.ID Equals up.TaskID Into upds = Group _
From u In upds.DefaultIfEmpty _
Order By t.TaskOrder, t.TaskNote, u.DateCreated Descending _
Select New With {t.ID, t.TaskNote, u.UpdateNote, u.DateCreated})
This is great for capturing all LP_tasks and their corresponding LP_updates. If there are no updates, it still returns the task (left outer join)
Now I want to limit updates to those that are in a specific date range. I canβt figure out how to do this without accepting all the tasks from the left side, which include updates, but do not meet the requirements of the date. Any WHERE clause that I add after upds.DefaultIfEmpty does this. Not sure what to do next.
source
share