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.
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 };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With