当前位置: 代码迷 >> ASP.NET >> group by 用linq或EF如何写
  详细解决方案

group by 用linq或EF如何写

热度:8287   发布时间:2013-02-26 00:00:00.0
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);
  相关解决方案