Can sombody, please, convert this simple SQL statment to Linq? [closed]
select *
, (
select AVG(RatingVal)
from Ratings
where Ratings.AppID = ID
) as average
from Applications
var result = from r in Ratings
group by r.AppID into rg
from a in applications
where a.ID = rg.Key
select new {Application = a, AvgRating = rg.Avg(r=>r.RatingVal)};
Haven't tested it, but that should work.
精彩评论