Hi I can make this query no prob in sql, but having trouble making it in Linq. can someone please recreate the folling in Linq for me?
SELECT
p.[Id]
,p.[SupplierId]
,p.[SupplierStatusId]
,p.[AircraftId]
,x.[Status]
FROM
(SELECT
a.PlanId,
a.CreatedDate,
s.Name AS [Status]
FROM
(SELECT
PlanId,
MAX(CreatedDate) AS CreatedDate
FROM PlanStatus
GROUP BY PlanId) a
LEFT JOIN PlanStatus ps ON a.PlanId = ps.PlanId AND a.CreatedDate = ps.CreatedDate
LEFT JOIN Status s ON ps.StatusId = s.Id
) x
LEFT JOIN Plans p ON x.PlanId = p.Id