score:2

Accepted answer

if the reviews property contains all reviews for a particular book this is simple:

var result = books.select(book => new
{
    book.title,
    rating = book.reviews.average(review => review.rating)
});

but if you have separate collections you will need to perform a join:

var result = books.groupjoin(reviews, // one-to-many        
    book => book.id,                  // primary key
    review => review.book.id,         // foreign key
    (book, reviews) => new            // selection
    {
        book.title,
        rating = reviews.average(review => review.rating)
    });

Related Query

More Query from same tag