int productSum = (from p in product
where (p.type = 1 || p.type = 2) && p.namePro = 'yoyo'
select p.PricePro).Sum();
น่าจะประมาณนี้นะคะ ไม่แน่ใจเท่าลองแต่ลองดูนะคะ
Date :
2012-11-05 16:25:01
By :
Tamakochang
No. 2
Guest
ขอมั่วมั่งดิ
Code (C#)
var data = from p in product
where p.namePro == "yoyo"
group p by p.namePro into g
select new
{
namePro = g.Key,
PriceProType1 = g.Where(p => p.type = 1).sum(p => p.PricePro),
PriceProType2 = g.Where(p => p.type = 2).sum(p => p.PricePro)
}
select