Home > Net >  Convert SQL to Lambda in C# with multiple tables
Convert SQL to Lambda in C# with multiple tables

Time:07-19

I have read multiple SQL to Lamda questions with joins etc. but i don't quiet understand, how to convert sql to lambda.

SELECT
    f.Name,
    v.Name
FROM
    Config AS c 
    JOIN Family AS f ON c.Family_ID = f.ID
    JOIN View AS v ON c.View_ID = v.ID

CodePudding user response:

Try:

var result =  (from f in Family
                join c in Config on f.ID equals c.Family_ID
                join v in View on c.View_ID equals v.ID
                select new { FamilyName = f.Name, Name = v.Name });
  • Related