Linq left join
linq inner join
from c in Categories
join o in Products on c.CategoryID equals o.CategoryID
select new { c.CategoryName, o.ProductName }
linq left join
from c in Categories
join o in Products on c.CategoryID equals o.CategoryID into ps
from o in ps.DefaultIfEmpty()
select new { c.CategoryName, o.ProductName }
into ps from o in ps.DefaultIfEmpty()
資料來源:
https://blog.miniasp.com/post/2010/10/14/LINQ-to-SQL-Query-Tips-INNER-JOIN-and-LEFT-JOIN.aspx