Linq Sql

2.Group By

var query= from order in queryOrderList
group order by order.ProxyID
into g
where g.Sum(u => u.Num) >= 5
select g.Key
;

等价于

select t2.ProxyID from (
select sum(Num) num,t.ProxyID from OrderTBs t GROUP BY t.ProxyID
) t2
where t2.num>5

3.Group By having

待补充

4.Sum

decimal? sum = _member.DbSet .Where(q => q.MemberID == 11) .Sum(q => (decimal?)q.ActiveAmount);  

原文地址:https://www.cnblogs.com/liandy0906/p/7155023.html