我有3个表,Customer,Surfboards和CustomerSurfboards。 CustomerSurfboards是Joiner表。
Customer CustomerSurfBoards Surfboards
---------- ------------------- ------------
CustomerID CustomerSurfboardID SurfBoardID
IsActive CustomerID
SurfboardID
我想选择客户IsActive = true
的所有冲浪板我需要使用C#
在Linq中执行此操作答案 0 :(得分: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;