2
Answers

Joining of two tables on Multiple fields

Adalat  Khan

Adalat Khan

3y
706
1

Hi, I have the following Linq query in which i am joining two tables using multiple fields but it gives me error that "The Type of the expression in Join Claus is incorrect. Type inferences fails in the call to group join":

 var depAirportCode = from b in dbContext.Bookingsjoin f in dbContext.Flights on new{Key1 = b.FlightInfoId,Key2 = b.OperatingAirlineCode,Key3 = b.RequestedFlightNumber}equals new{Key1 = f.FlightInfoId,Key2 = f.OperatingAirlineCode,Key3 = $"{f.OperatingAirlineCode}{f.OperatingFlightNumber}"}into result where b.BookingReference == "AP15-1464"
select b.DepartureAirportCode;
Answers (2)