You need a GROUP BY
in your query. Try this
SELECT Film.Title, AVG(Rate.rating)
FROM Rate
INNER JOIN Film ON Rate.uidFilm = Film.uidFilm
GROUP BY Film.Title;
This should give you the average ratings of all movies with their title.
Вопрос
I have 3 tables :
Film.rating
is the average of ratings for that film from the Rate
table.
In SQL, to calculate film rating I would do:
SELECT AVG(Rate.rating)
FROM Rate, Film
WHERE Rate.uidFilm=Film.uidFilm;
I do not know how to write this in MS Access and where I should put this (or maybe another?) formula?
How do I 'connect' Film.rating with the calculation above?
In constructor for the Film
table?
Решение
You need a GROUP BY
in your query. Try this
SELECT Film.Title, AVG(Rate.rating)
FROM Rate
INNER JOIN Film ON Rate.uidFilm = Film.uidFilm
GROUP BY Film.Title;
This should give you the average ratings of all movies with their title.