I get below data from Postgresql table, need to sum the ListDate field for each month and transpose. I tried this link
CodePudding user response:
var query = list
.GroupBy(g =>
g.ListDate.ToString()
)
.Select(group => new {
MM = group.Sum(s => s.MM),
FC = group.Sum(s => s.FC),
AMS = group.Sum(a => a.AMS),
KS = group.Sum(c => c.KS)
});