当前位置: 动力学知识库 > 问答 > 编程问答 >

entity framework - Convert SQL QUERY to LINQ TO ENTITIES

问题描述:

I wont to select top 4 for operators ( having max count in user table)

SELECT TOP 4 [Operator], COUNT(Operator) as opCount

FROM [Users]

Group by Operator

order by opCount desc

网友答案:

Please try something like this.

var result = db.Users.Take(4).GroupBy(y=>y.Operator).ToList();
分享给朋友:
您可能感兴趣的文章:
随机阅读: