我有以下查询:
var query = (from o in orders
group new
{
o.OrderDate,
o.paymenttotal
}
by new
{
o.OrderDate.Value.Month,
o.OrderDate.Value.Year
} into grouping
orderby grouping.Key.Month
select new
{
grouping,
totalPayment = grouping.Sum (g => g.paymenttotal)
});
query.Dump();
查询工作得很好,它给出了每个月总计的细分,我想扩展查询以添加所有总计的总和,所以我可以有一个“页脚总计”。
希望这是有道理的。