日期:2014-05-20  浏览次数:20373 次

group by 用linq或EF怎么写
ado.net 查询“select typeID from product group by typeID”

我这样写
from l in product where l.Isdel== false
group l by l.typeI into g select g 查询出来的结果多了一列
用linq或EF该怎么写?

------解决方案--------------------
from l in product where l.Isdel== false
group l by l.typeI into g select g.Key
------解决方案--------------------
C# code
var query=db.product.Where(l=>l.Isdel==false).GroupBy(l=>l.typeI).Select(g=>g.Key);