这条sql怎么改写为linq呢!急求!!!
SELECT workrecord.FinalStatus,count(JobInfo.GID) as StatusCount
FROM JobInfo
INNER JOIN Task ON JobInfo.GID = Task.JobId
Left JOIN WorkRecord ON WorkRecord.JobId = JobInfo.GID
where Task.EngineerID='aaa' and (WorkRecord.FinalStatus='bbb' or WorkRecord.FinalStatus='ccc')
Group by WorkRecord.FinalStatus
------解决方案--------------------不想写了,参考http://www.cnblogs.com/Mayvar/archive/2011/07/04/wanghonghua_20110704.html
------解决方案--------------------var query=from j in JobInfo
join t in Task.Where(x=>x.EngineerID=="aaa") on j.GID equals t.JobId
join wr in WorkRecord.Where(x=>x.FinalStatus=="bbb"
------解决方案--------------------
x.FinalStatus=="ccc")
on wr.JobId equals j.GID into leftGroup
from wr in leftGroup.DefaultIfEmpty()
group wr by wr.FinalStatus into g
select new {FinalStatus=g.Key,StatusCount=g.Count()};
------解决方案--------------------var qurey=from j in JobInfo
join t in Task.Where(x=>x.EngineerId=="aaa") on j.GID equals t.JobId
join w in WorkRecord.Where(x=>x.FinalStatus='bbb'
------解决方案--------------------x.FinalStatus='ccc')
on w.GID equals t.JobId into leftgroup from w in leftgroup.DefaultIfEmpty()
group w in w.FinalStatus into q
select new{FinalStatus=q.Key,StatusCount=q.Count()}