I have two tables
Video
- VideoId,
- VideoName,
- VideoUrl
Comment
- CommId,
- VideoId,
- CommentDesc,
- Rating
I want to join and get average rating for video using LINQ
How can I do this?
I have two tables
Video
Comment
I want to join and get average rating for video using LINQ
How can I do this?
var query = from video in Video join
comment in Comment on comment.VideoId equals video.VideoId;
Console.WriteLine("Average Rating: " + query
.Where(i => i.VideoName = videoName)
.Average(i => i.Rating));