Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

LINQ: 2 join with group by

var query = (
        //Customers
        from customer in context.Customers

        //Engineer 1
        join engineer1 in context.Employees on customer.PrimaryEngineer equals
        engineer1.EmployeeId into eng1 
        from engineer1 in eng1.DefaultIfEmpty()

        //Engineer Top
        join engineerTop in context.Employees on customer.TopEngineer equals 
        engineerTop.EmployeeId into top
        from engineerTop in top.DefaultIfEmpty()
        group new {customer, engineer1, engineerTop} by new {CustName = customer.Name, EmpId1 = engineer1.EmployeeId, EmpId2 = engineerTop.EmployeeId} into grp
        select new
        {
            Name = grp.Key.CustName,
            EmpId1 = grp.Key.EmpId1,
            EmpId2 = grp.Key.EmpId2
        });
Comment

PREVIOUS NEXT
Code Example
Csharp :: get device name c# console 
Csharp :: c# recursion formula for the factorial 
Csharp :: set text in unity invisible 
Csharp :: callling class c# 
Csharp :: c# datagridview double click on cell 
Csharp :: C# domain name to ip address 
Csharp :: check if mouse is in frame unity 
Csharp :: XMLWriter write xml C# 
Csharp :: Failed to generate swagger file. Error dotnet swagger tofile --serializeasv2 --output 
Csharp :: unity initialize array 
Csharp :: c# iterate sorteddictionary 
Csharp :: c# add list to list 
Csharp :: unity c# move transform 
Csharp :: c sharp 
Csharp :: c# add strings 
Csharp :: freeze scene unity 
Csharp :: ultimate space cruiser 
Csharp :: How to use the protected keyword in C# 
Csharp :: c# create class from parent class 
Csharp :: private Vector3 direction; 
Csharp :: how to check type in c# 
Csharp :: monogame delta 
Csharp :: how to make a block disappear in unity 
Csharp :: speech 
Csharp :: dynamic add event control c# 
Csharp :: invalidoperationexception c# ui thread 
Csharp :: cant find desktop and documents folder macOs 
Csharp :: drawing default serializedproperty unity 
Csharp :: c# streamreader to file 
Csharp :: tilemap shader 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =