When it comes to querying data in .NET applications, LINQ (Language Integrated Query) is a powerful tool. One of its essential features is the ability to perform joins, allowing you to combine data from multiple sources. In this guide, we’ll delve into the how to do joins in LINQ on multiple Columns

Joins in LINQ on multiple Columns

Example: Joins in LINQ on multiple Columns

Scenario 1 : Columns name are same

var mResult = from tbl1 in Table1
              join tbl2 in Table2
              on new { tbl1.field1, tbl1.field2 } equals new { tbl2.field1, tbl2.field2 }


Scenario 2 : Columns name are different

var mResult = from tbl1 in Table1
              join tbl2 in Table2
               on new {tbl1.field1, tbl1.field2 } equals new 

{ field1=tbl2.Column1, field2 = tbl2. Column2}
Joins in LINQ on multiple Columns: Free Guide