1

I want to join two tables with linq, but i want to do it with OR condition in the join.

Something like this

var result = from x in entity1
             join y in entity2
             on new { X1= x.field1, X2= x.field2 } equals 
             new { X1 = y.field1, X2 = y.field2 or X2="A" }

is it possible, or i have to do something else?

I can do it with sql but i can't do the same with linq.

With sql i do something like this

select * 
from entity1 x
inner join entity2 y on x.field1 = y.field1 and (x.field2 = y.field2 or x.field2 = "A")

any suggestions?

Igor
  • 60,821
  • 10
  • 100
  • 175

0 Answers0