I have a mysql table of temperature readings.
How can I find the date of MAX(Temperature) and the date of MIN(Temperature)?
My table looks like this:-
EpochDate as String
ReadingDate as Date
Temperature as Float
Pressure as Float
mysql date of min, max
-
- Posts: 195
- Joined: Tuesday 26th September 2017 3:17pm
- Location: NW England
Re: mysql date of min, max
SELECT
"EpochDate",
'max' as ind
FROM yourtable
WHERE temperature = (Select Min("Temperature") from yourtable)
UNION
SELECT
"EpochDate",
'min' as ind
FROM youtable
WHERE temperature = (Select Max("Temperature") from yourtable);
(or whatever the equivalent SQL is in that g-awful rdbms is).
You should get the jist anyway.
"EpochDate",
'max' as ind
FROM yourtable
WHERE temperature = (Select Min("Temperature") from yourtable)
UNION
SELECT
"EpochDate",
'min' as ind
FROM youtable
WHERE temperature = (Select Max("Temperature") from yourtable);
(or whatever the equivalent SQL is in that g-awful rdbms is).
You should get the jist anyway.
Have you ever noticed that software is never advertised using the adjective "spreadable".
-
- Posts: 195
- Joined: Tuesday 26th September 2017 3:17pm
- Location: NW England
Re: mysql date of min, max
Thanks for that, struggling to translate your query to mysql syntax.
However, there would be a problem because there could easily be several maximum temperatures with completely different dates.
I need to re-think this.
Thanks again
However, there would be a problem because there could easily be several maximum temperatures with completely different dates.
I need to re-think this.
Thanks again