Inner join with Multiple condition on left join using Linq

Viewed 28

following query is throwing error "The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'GroupJoin"

from ph in context.PrPayfileHeaders
                     join pp in context.PrPayfileParticipants on ph.PayfileHeaderId equals pp.PayfileHeaderId
                     join sec in context.SecUsers on pp.AnalystUserId equals sec.UserId
                     join hp in context.HcmPerson on  // Error statement
                     new
                     {
                         key1 = pp.ParticipantEmpNumber,
                         key2 = ph.PayPeriod
                     }
                     equals
                     new
                     {
                         key1 = hp.EmployeeNumber,
                         key2 = hp.PeriodId
                     }
                     into fg
                     from fgi in fg.DefaultIfEmpty()
                     where ph.PayfileType == payFileType && ph.IntfControlId == intf_Control_Id && (region == null || ph.RegionName == region)
                     select new FinalPayFileInfo
                     {
                         Participant_id = pp.PayfileParticipantId,
                         Home_country = fgi.HomeCountry,
                         Region_name = ph.RegionName,
                         Analyst_name = sec.FirstName + " " + sec.LastName,
                         Full_name = fgi.FullName,
                         Department = pp.DeptNumber,
                         Cost_center = pp.CostCenter,
                         Local_currency = pp.LocalCurrency,
                         Comm_attribute1 = pp.CommAttribute1,
                         Comm_attribute2 = pp.CommAttribute2,
                         Comm_attribute3 = pp.CommAttribute3,
                         Comm_attribute4 = pp.CommAttribute4,
                         Comm_attribute5 = pp.CommAttribute5,
                         Comm_attribute6 = pp.CommAttribute6,
                         Comm_attribute7 = pp.CommAttribute7
                     };
0 Answers
Related