Hi ALL, I have data like this
productid cost
prant 6.70
prant 0
prant 7.0
gant 8.7
gant 0.1
gant 4.5
how can i flatten them into one result as "prant 13.70 gant 13.3" in Linq To sql
My linq query gives me two rows
Results:
prant 13.7
gant 13.3
Query:
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)
};
can someone help me out
Thanks