Just wondering how the following sql query would look in linq for Entity Framework…
SELECT KPI.*
FROM KeyPerformanceIndicator KPI
INNER JOIN (
SELECT SPP.SportProgramPlanId
FROM SportProgramPlan PSPP
INNER JOIN SportProgramPlan ASPP
ON (PSPP.SportProgramPlanId = @SportProgramPlanId
AND PSPP.StartDate >= ASPP.StartDate
AND PSPP.EndDate <= ASPP.EndDate)
) AS SPP
ON KPI.SportProgramPlanId = SPP.SportProgramPlanId
Cheers
Anthony
Hard to say without seeing the associations in your model. Would there be a self-referential association on
SportProgramPlan?The SQL seems like an error to me as
PSPPandASPPcould be the same record, and I’m not sure you want that? At any rate, it’s trivial to exclude….Here’s a shot at it: