Expand|Select|Wrap|Line Numbers
- SELECT Nation.Nation, LinkFilmNation.[Nation ID], Count(*) AS Total, Avg(Film.[Score]) AS [Average Score]
- FROM Film INNER JOIN Nation INNER JOIN LinkFilmNation ON Nation.[Nation ID] = LinkFilmNation.[Nation ID]) ON Film.[Film ID] = LinkFilmNation.[Film ID]
- GROUP BY Nation.Nation, LinkFilmNation.[Nation ID], Film.Status, Film.Ok
- HAVING (((Film.Status)="Seen") AND ((Film.Ok)=Yes))
- ORDER BY Count(*) DESC;
I think the answer lies in the linked table where each entry has a unique ID (LinkFilmNation ID). The table has three colums:
Expand|Select|Wrap|Line Numbers
- SELECT LinkFilmNation.[LinkFilmNation ID], LinkFilmNation.[Film ID], LinkFilmNation.[Nation ID]
- FROM LinkFilmNation;
A simplified example in layman's terms:
According to the site IMDb.com, the movie The Matrix (Film ID = 25) has two production nations, the USA and Australia. For this movie the LinkFilmNation ID's are 1051 and 1052. With the current query I would get the following (simplified):
Nation ID Nation Total
53 USA 1
12 Australia 1
What a want is that each movie (aka Film ID) counts only one time; therefore the query should only use the entry marked 1051 and discard the other entry that goes with the same Film ID (1052). This would result in:
Nation ID Nation Total
53 USA 1
And this is what I want.
I hope I made myself clear enough. Thank you. Margie