-17

I need multiple condition in Linq Join.

What could be the equivalent of

select * 
from tblOfferingBillingBehaviorMapping billMap
inner join tblLookUpBillingBehavior lkpBill 
    on (billMap.LkpBillingBehaviorId =lkpBill.LkpBillingBehaviorId 
        or billMap.LkpBillingBehaviorId =lkpBill.ParentRootId) 
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
Red Swan
  • 15,157
  • 43
  • 156
  • 238
  • No quick answer: LINQ only supports equality for the `join` clause. You could use multiple `from` clauses with a `where`. – Richard Apr 19 '17 at 07:58
  • use `functional syntax` for understanding how it works and all be just fine –  Apr 19 '17 at 07:58

2 Answers2

1
var query = from [record] in [table]
                        join [table that you join] 
                        in [name of the table] 
                        on [record] equals [record in the other table]
                        select new { [Column Name] = [Table].[Record] };

You can do it this way if you use a query. I don't know how to perform that in linq p => p. style. Hope this is helpful. And here is an example:

var query = from person in people
                        join pet in pets on person equals pet.Owner
                        select new { OwnerName = person.FirstName, PetName = pet.Name };
0

You could also do a cross join with a where condition similar to your inner join condition

var q1 = from billMap in tblOfferingBillingBehaviorMapping 
         from lkpBill in tblLookUpBillingBehavior 
         where billMap.LkpBillingBehaviorId == lkpBill.LkpBillingBehaviorId || billMap.LkpBillingBehaviorId =lkpBill.ParentRootId
         select new { billMap, lkpBill };
Liviu Boboia
  • 1,734
  • 1
  • 10
  • 21