diff --git a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs index b6fb68c..37986df 100644 --- a/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs +++ b/ReportingServices.Shared/Repositories/Implementations/ScrapeDatabaseRepository.cs @@ -34,10 +34,16 @@ public class ScrapeDatabaseRepository : IScrapeDatabaseRepository SqlCommand cmd = _connection.CreateCommand(); - string query = "SELECT COUNT(*) FROM " + - "(SELECT REACTOR, COUNT(PROD_SPEC_ID) - 1 AS PCHANGE FROM " + - "(SELECT REACTOR, PROD_SPEC_ID, COUNT(WO) AS PSN_COUNT FROM RDS WHERE DATE_OUT BETWEEN @startDate AND @endDate GROUP BY REACTOR, PROD_SPEC_ID) AS t " + - "GROUP BY REACTOR) AS l WHERE PCHANGE > 0"; + string query = "SELECT SUM(PCHANGE) " + + " FROM (SELECT REACTOR, " + + " COUNT(PROD_SPEC_ID) - 1 AS PCHANGE " + + " FROM (SELECT REACTOR, " + + " PROD_SPEC_ID, " + + " COUNT(WO) AS PSN_COUNT " + + " FROM RDS " + + " WHERE DATE_OUT BETWEEN @startDate AND @endDate " + + " GROUP BY REACTOR, PROD_SPEC_ID) AS t " + + " GROUP BY REACTOR) AS l"; cmd.CommandText = query; _ = cmd.Parameters.AddWithValue("@startDate", startDate);