Skip to content

Commit

Permalink
Amend query to mitigate impact of #623
Browse files Browse the repository at this point in the history
  • Loading branch information
sussexrick committed Sep 17, 2022
1 parent 8d42d27 commit fa7b6ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public async Task<Player> ReadPlayerByRoute(string route, StatisticsFilter filte

// This assumes it should only be needed here, not in other statistics queries.
var playerData = await connection.QueryAsync<Player, PlayerIdentity, Team, Player>(
$@"SELECT PlayerId, PlayerRoute, (SELECT MemberKey FROM {Tables.Player} WHERE PlayerRoute = @Route) AS MemberKey,
$@"SELECT PlayerId, PlayerRoute, (SELECT TOP 1 MemberKey FROM {Tables.Player} WHERE PlayerRoute = @Route) AS MemberKey,
PlayerIdentityId, PlayerIdentityName,
(SELECT COUNT(DISTINCT MatchId) AS TotalMatches FROM {Tables.PlayerInMatchStatistics} WHERE PlayerIdentityId = identities.PlayerIdentityId {where}) AS TotalMatches,
(SELECT MIN(MatchStartTime) AS FirstPlayed FROM {Tables.PlayerInMatchStatistics} WHERE PlayerIdentityId = identities.PlayerIdentityId {where}) AS FirstPlayed,
Expand Down

0 comments on commit fa7b6ec

Please sign in to comment.