摘要:
学习Linq时,经常会遇到Linq使用Group By问题,这里将介绍Linq使用Group By问题的解决方法。 1.计数var q = from product in db.Products group product by product.CategoryID into g select new { g.Key, NumProducts = g.Count() }; 语句描述:Linq使用Group By和Count得到每个CategoryID中产品的数量。说明:先按CategoryID归类,取出CategoryID值和各个分类产品的数量。 2.带条件计数var q = ... 阅读全文
posted @ 2012-06-26 17:21
wboweb
阅读(180)
评论(0)
推荐(0)

浙公网安备 33010602011771号