3 回答
TA贡献1963条经验 获得超6个赞
using (DataContext dc = new DataContext())
{
var q = from t in dc.TableTests
group t by t.SerialNumber
into g
select new
{
SerialNumber = g.Key,
uid = (from t2 in g select t2.uid).Max()
};
}
TA贡献1712条经验 获得超3个赞
var q = from s in db.Serials
group s by s.Serial_Number into g
select new {Serial_Number = g.Key, MaxUid = g.Max(s => s.uid) }
TA贡献1797条经验 获得超6个赞
以方法链形式:
db.Serials.GroupBy(i => i.Serial_Number).Select(g => new
{
Serial_Number = g.Key,
uid = g.Max(row => row.uid)
});
- 3 回答
- 0 关注
- 835 浏览
添加回答
举报