Skip to main content

Linq to Sql:Inner join

In this post i am going to show you how to generate inner join using linq to sql.
For this post i am going to use Categories and Product table of northwind.



Let's imagine that you want to fetch CategoryName and ProductName from above table using linq.




var query=from p in Products
          join c in Categories
          on p.CategoryID equals c.CategoryID
          select new
          {
          CategoryName=c.CategoryName,
          ProductName=p.ProductName
          };
 
 
 

Comments

Popular posts from this blog