日期:2014-05-20 浏览次数:20990 次
var result = from p in db.Result
where
//&& (string.IsNullOrEmpty(strDepName) ? 1 == 1 : p.DepName == strDepName)
group p by new { Name = (groupName == "UserName") ? p.UserName : p.DepName } into pGroup
select new
{
Name = pGroup.Key.Name,
Total= pGroup.Sum<Result>(item => item.Type == "A" ? item.Total : 0)
};