Name No Qty
A 1 50
A 2 60
B 12 10
C 13 70
Result:
A 1,2 110
B 12 10
C 13 70
var groupResult = data.ToLookup(s => s.Name);
string symbol=",";
foreach (var c in groupCPSPNResult)
{
result.Add(new
{
Name= c.Key.Name,
No= string.Join(symbol, c.Select(s => s.No).ToArray()),
Total= c.Sum(s => s.Qty)
});
}
沒有留言:
張貼留言