日期:2014-05-20 浏览次数:20745 次
var query=from a in ( from sf in Staff join at in adminType on sf.Stationid equals ad.ID join ad in admin_Deptadmin on sf.Code equals ad.loginID join dp in Department on ad.DeptId equals dp.Id where at.Level==1 && sf.bureauid==1 select new { sGuid=sf.Guid, isCharge=sf.isCharge, dName=dp.Name }) group a by a.sGuid into g select new { sGuid=g.Key, hr=g.Where(m=>m.dName=="从事部").Max(), temp=g.Where(m=>m.dName=="临时部门").Max(), mony=g.Where(m=>m.dName=="财务部").Max() };
------解决方案--------------------
hr=g.Where(m=>m.dName=="从事部").Select(m=>m.dName).Max(),
temp=g.Where(m=>m.dName=="临时部门").Select(m=>m.dName).Max(),
mony=g.Where(m=>m.dName=="财务部").Select(m=>m.dName).Max()
只提供思路参考