我正在与SQL Server数据库一起学习ASP.Net MVC,并陷入了Linq操作查询中。有人可以帮我将这个SQL查询转换为Linq吗?
SELECT ShipName, COUNT(*) AS ShipValues
FROM Invoinces GROUP BY ShipName HAVING COUNT(*) > 30
答案 0 :(得分:0)
尝试一下
var result = Invoinces.GroupBy(x => x.ShipName)
.Where(y => y.Count() > 30)
.Select(o => new {ShipName = o.ShipName, Count = o.Count()});