Linq to sql linq到sql查询的帮助
我有这样的数据Linq to sql linq到sql查询的帮助,linq-to-sql,Linq To Sql,我有这样的数据 productid cost prant 6.70 prant 0 prant 7.0 gant 8.7 gant 0.1 gant 4.5 如何在LINQtoSQL中将它们展平为一个结果,即“prant 13.70 gant 13.3” 我的linq查询提供了两行 结果: prant 13.7 gant 13.3 查询: from c in test group new {c} by new
productid cost
prant 6.70
prant 0
prant 7.0
gant 8.7
gant 0.1
gant 4.5
如何在LINQtoSQL中将它们展平为一个结果,即“prant 13.70 gant 13.3”
我的linq查询提供了两行
结果:
prant 13.7
gant 13.3
查询:
from c in test
group new {c}
by new {
c.productid
} into g
select new
{
ProductIdandAmount = g.Key.productid + g.Sum(p => p.c.cost)
};
有人能帮我吗
谢谢您已经实施了map,现在您需要实施reduce:
var query = from c in test ...
var summary = string.Join(" ", query.ToArray());
错误:“string.Join(string,string[])的最佳重载方法匹配有一些无效参数 参数“2”:无法从“AnonymousType#1[]”转换为“string[]” 我试过你给我的密码给我两个错误