Pho3nix
The Legend
Hi guys,
I'm confused :?
I'm trying to run this code :
I should get a result of 3 ; but when converted to LinqToEntities from an app :
I get 2 :\ any reason for this. Will post up my own code in a bit, just been messing around so I have to rewrite it.
Thoughts?
I'm confused :?
I'm trying to run this code :
Code:
SELECT AVG(Rating) FROM [VideoRating]
Where VideoId = '1'
Code:
from videoratings in
(from videoratings in db.VideoRatings
where
(Double)videoratings.VideoId ==
(from videoratings0 in db.VideoRatings
select new {
videoratings.Rating
}).Average(p => videoratings.Rating)
select new {
videoratings.Rating,
Dummy = "x"
})
group videoratings by new { videoratings.Dummy } into g
select new {
Column1 = (System.Double?)g.Average(p => p.Rating)
}
I get 2 :\ any reason for this. Will post up my own code in a bit, just been messing around so I have to rewrite it.
Thoughts?