Reputation: 12864
Can someone please help convert the following into LINQ To SQL query?
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)
Upvotes: 0
Views: 108
Reputation: 2583
try this
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;
Upvotes: 1