From fa7b6ecea8e4e3d7ae7b3ea1ddd55a4b82ff29d6 Mon Sep 17 00:00:00 2001 From: Rick Mason Date: Sat, 17 Sep 2022 21:03:39 +0100 Subject: [PATCH] Amend query to mitigate impact of #623 --- Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs b/Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs index fa4c8ed7..44a66c70 100644 --- a/Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs +++ b/Stoolball.Data.SqlServer/SqlServerPlayerDataSource.cs @@ -187,7 +187,7 @@ public async Task ReadPlayerByRoute(string route, StatisticsFilter filte // This assumes it should only be needed here, not in other statistics queries. var playerData = await connection.QueryAsync( - $@"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,