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

sql转linq
select max(StuId) from StudentInfo group by StuName having count(StuName)>1
转Linq怎么写,谢谢哈
linq

------解决方案--------------------
var list=StudentInfo.GroupBy(t=>t.StuName).Where(t=>t.Count()>1).Select(t=>t.Max(tt=>tt.StuId)).ToList();

------解决方案--------------------
select max(StuId) from StudentInfo group by StuName having count(StuName)>1
先转汉语:
选择StudentInfo表中StuName字段重复的记录,并且或者这些重复记录中StuId最大的那个。
再转linq
参考1楼。