2009-11-06 63 views
1

我有3個表格,Customer,Surfboards和CustomerSurfboards。 CustomerSurfboards是Joiner表。Linq從3個表格中使用Joiner表格查詢

Customer  CustomerSurfBoards Surfboards 
---------- ------------------- ------------ 
CustomerID CustomerSurfboardID SurfBoardID 
IsActive  CustomerID 
       SurfboardID 

我想選擇其中客戶IsActive =真

,我需要做Linq中使用C#

+0

語言的所有衝浪板,請。 –

+0

C#,對不起有關 – Slee

+0

僅供參考谷歌索引此頁在5分鐘內 – Slee

回答

4
var query = from sb in db.Surfboards 
      join csb in db.CustomerSurfBoards on sb.SurfBoardID equals csb.SurfBoardID 
      join c in db.Customers on csb.CustomerID equals c.CustomerID 
      where c.IsActive 
      select sb; 
+0

大聲笑,出於某種原因,當我寫在VS intellisense告訴我這是錯的 - 謝謝 – Slee