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

帮忙看看.在线等!
select UserId as id,count(Style) as number from A where Style=1006 group by UserId order by number desc

此句sql 帮忙翻译成Linq形式 . 谢过!

------解决方案--------------------
C# code
var result = A.Where(c => c.Style == 1006)
    .GroupBy(g => g.UserId)
    .Select(e => new { id = e.Key, number = e.Count() })
    .OrderByDescending(o => o.number);

------解决方案--------------------
C# code

var query=A.Where(w=>w.Style==1006)
           .GroupBy(g => g.UserId)
           .Select(s => new { id = s.Key, number = s.Count()})
           .OrderByDescending(o => o.number);

------解决方案--------------------
探讨
引用:
C# code
var result = A.Where(c => c.Style == 1006)
.GroupBy(g => g.UserId)
.Select(e => new { id = e.Key, number = e.Count() })
.OrderByDescending(o => o.number);

我如何取得这个对象的某……