var result = from p in dbContext.mytable
where p.Prod == 1
group p by p.Prod into g
select new
{
Costname = g.Select(p => p.Costname),
Sum = g.Sum(p => p.Price)
};
foreach (var r in result)
{
foreach (var c in r.Costname)
{
Console.Write(c.ToString());
}
Console.Write(r.Sum.ToString());
}