Reputation: 18797
What would be the equivalent of the following T-SQL query in L2E using Lambda expressions?
Select * from a INNER JOIN b on a.Foo = b.Foo OR a.Foo = b.Bar
I want to join a and b when a.Foo
equal to b.Foo
OR b.Bar
Thanks.
Upvotes: 5
Views: 2840
Reputation: 1503439
You can't do an "or" style join in LINQ with an actual join clause. All join clauses in LINQ are equijoins. The closest you can come is a where clause:
var query = from a in A
from b in B
where a.Foo == b.Foo || a.Foo == b.Bar
select new { a, b };
Upvotes: 9