I need to convert some SQL statement to LINQ. How convert LEFT OUTER JOIN to equivalent LINQ statement? 解决方案 You need to use the DefaultIfEmpty operator. The below code should result in a left outer join.var q = from c in customers join o in orders on c.Key equals o.Key into g from o in g.DefaultIfEmpty() select new {Name = c.Name, OrderNumber = o == null ? "(no orders)" : o.OrderNumber};Credit to: http://www.hookedonlinq.com/OuterJoinSample.ashx 这篇关于左外连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 16:14