有人可以帮助将以下内容转换为LINQ To SQL查询吗?
select * from projects pr
where pr.Active<>0
AND CapturedDocumentType=2
AND SubmissionReminderTypeID > 0
AND pr.ProjectID In(SELECT Max(wpr.ProjectID) as ProjID
FROM Projects wpr
where wpr.Active<>0
AND wpr.CapturedDocumentType=2
AND wpr.SubmissionReminderTypeID > 0
group by wpr.EmployeeID)
答案 0 :(得分:1)
试试这个
var result = from pr in dc.Projects
where
(from wpr in dc.Projects
where wpr.Active &&
wpr.CapturedDocumentType == 2 &&
wpr.SubmissionReminderTyepID > 0
group wpr by wpr.EmployeeID into gpr
select gpr.Max(x => x.ProjectID)).Contains(pr.ProjectID)
select pr;