我有这个SQL查询,它提供了我想要的结果。请帮我把它转换成LINQ。
SELECT skill, sum (skillLevel)
FROM ReportView
WHERE jobTitle = 'Graphic Designer'
GROUP BY skill
查询给出如下结果。
skill (No column Name)
-------------------------------
Photoshop 10
Illustrator 8
我试过这个,但是我收到了匿名类型错误。
var results = db.ReportViews
.Where(x => x.jobTitle == "Graphic Designer")
.GroupBy(x => x.skill)
.Select(y =>
new
{
skill = y.Select(x => x.skill),
skillLevel = y.Sum(s => s.skillLevel)
}).ToList();