diff options
Diffstat (limited to 'AirPollutionWebApi')
-rw-r--r-- | AirPollutionWebApi/Controllers/ReadingsController.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/AirPollutionWebApi/Controllers/ReadingsController.cs b/AirPollutionWebApi/Controllers/ReadingsController.cs index 480d8c0..99965e6 100644 --- a/AirPollutionWebApi/Controllers/ReadingsController.cs +++ b/AirPollutionWebApi/Controllers/ReadingsController.cs @@ -30,7 +30,8 @@ namespace AirPollutionWebApi.Controllers [Route("api/Readings/latest")]
public IHttpActionResult GetLatestReading()
{ - var command = "SELECT MAX(TimeStamp) FROM Readings"; + var command = "SELECT * FROM Readings " +
+ "WHERE TimeStamp IN(SELECT MAX(TimeStamp) FROM Readings)"; var reading = SqlOperator.GetReadings(command)[0]; if (reading != null) return Ok(reading); |