Thanks - I really appreciate the help with this one.
The background is this…
Any given lodge will only be in one country.
Any given lodge can receive multiple votes in any given category.
But any given lodge can only receive one nomination in any given category, in any given country (for any given year).
So for example a Lodge might be
LodgeID, Lodge, CountryID
798, Borana Lodge, 1
With countries:
CountryID, Country
1, Kenya
With scores
ScoreID, LodgeID, CategoryID, Score
1, 798, 1, 3
2, 798, 1, 6
3, 798, 1, 9
4, 798, 2, 8
5, 798, 2, 8
6, 798, 2, 8
7, 798, 3, 8
8, 798, 3, 9
9, 798, 3, 10
etc
With categories
CategoryID, Category
1, Best Value
2, Best Cuisine
3, Best Walking
With nominations:
NominationID, CategoryID, SW_finalist, SW_rank
1, 3, Yes, 1
2, 6, Yes, 5
3, 9, Yes, 10
So Borana Lodge is in Kenya, has had three votes each in Best Value, Best Cuisine and Best Walking, and has had one record added to the nomination for each of those categories.
And I’d like to output from that:
LodgeID, Lodge, CategoryID, CountryID, ScoreCount, AverageScore, NominationID, SW_finalist, SW_rank
798, Borana Lodge, 1, 1, 3, 6, 1, Yes, 1
798, Borana Lodge, 2, 1, 3, 8, 2, Yes, 5
798, Borana Lodge, 3, 1, 3, 9, 3, Yes, 10
It arguably is slightly convoluted with scores and nominations, but the idea is that scores records all the individual votes, which can obviously be many for any given category.
But nominations just needs one record per lodge for any given category in any given country. And then additional fields in the nominations table can be used to record whether the lodge is a finalist, runner up or winner in that category for that country. SW_finalist and SW_rank fields above are for judges to flag a loge as a potential finalist and give it rank of 1-10 if they think it makes the top 10.
Hope that makes sense - it does feel like its pretty much there apart form this multiple counting issue.
Thanks again.