开发者

Linq query from 3 tables using Joiner table

I have 3 tables, Customer, Surfboards, and CustomerSurfboards. CustomerSurfboards is the Joiner table.

Customer    开发者_StackOverflow社区  CustomerSurfBoards    Surfboards   
----------    -------------------   ------------  
CustomerID    CustomerSurfboardID   SurfBoardID
IsActive      CustomerID
              SurfboardID 

I want to select all surfboards where the customer IsActive = true

And I need to do this in Linq using C#


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜