P
Paul W Smith
SELECT [tPlayers]![PlayerFirstName] & " " & [tPlayers]![PlayerSecondName] &
" (" & [tPlayers]![TeamName] & ")" AS FullName, Sum(T.Score) AS Ranking,
tPlayers.PlayerID
FROM LeagueRoundsPlayed, ___PlayerRankings AS T INNER JOIN tPlayers ON
T.PlayerID = tPlayers.PlayerID
WHERE ((((SELECT COUNT(*) FROM ___PlayerRankings T1 WHERE T1.PlayerID =
T.PlayerID AND T1.Score >= T.Score))<=[LeagueRoundsPlayed]![RankingGames]))
GROUP BY [tPlayers]![PlayerFirstName] & " " & [tPlayers]![PlayerSecondName]
& " (" & [tPlayers]![TeamName] & ")", tPlayers.PlayerID, T.PlayerID
ORDER BY Sum(T.Score) DESC;
The above query works to a point - it is designed to produce a metric which
is the top n scores for a player, where n is a moving number depending on
which week of the season we are at.
The above query works fine when each score a player makes is different, but
fails when a player has multiple scores covering the 'cut-off' point e.g.
Data
Player 1 scores - 23, 45, 24, 33, 12, 20 - if n = 5 the query would return
145 which is the sum of the top 5 scores.
Player 1 scores - 23, 45, 24, 33, 12, 20, 20 - if n now equals 6 the
query returns 125. This is because it does not count one of the 20s as it
should, it sums the top 5 scores even though I want the top 6.
I haver to admit I do not fully understand the query, having been given it a
while ago from this forum.
If anyone can assist me in amending the query to achieve the results I have
tried to decsibe above I would be very very grateful.
" (" & [tPlayers]![TeamName] & ")" AS FullName, Sum(T.Score) AS Ranking,
tPlayers.PlayerID
FROM LeagueRoundsPlayed, ___PlayerRankings AS T INNER JOIN tPlayers ON
T.PlayerID = tPlayers.PlayerID
WHERE ((((SELECT COUNT(*) FROM ___PlayerRankings T1 WHERE T1.PlayerID =
T.PlayerID AND T1.Score >= T.Score))<=[LeagueRoundsPlayed]![RankingGames]))
GROUP BY [tPlayers]![PlayerFirstName] & " " & [tPlayers]![PlayerSecondName]
& " (" & [tPlayers]![TeamName] & ")", tPlayers.PlayerID, T.PlayerID
ORDER BY Sum(T.Score) DESC;
The above query works to a point - it is designed to produce a metric which
is the top n scores for a player, where n is a moving number depending on
which week of the season we are at.
The above query works fine when each score a player makes is different, but
fails when a player has multiple scores covering the 'cut-off' point e.g.
Data
Player 1 scores - 23, 45, 24, 33, 12, 20 - if n = 5 the query would return
145 which is the sum of the top 5 scores.
Player 1 scores - 23, 45, 24, 33, 12, 20, 20 - if n now equals 6 the
query returns 125. This is because it does not count one of the 20s as it
should, it sums the top 5 scores even though I want the top 6.
I haver to admit I do not fully understand the query, having been given it a
while ago from this forum.
If anyone can assist me in amending the query to achieve the results I have
tried to decsibe above I would be very very grateful.