Page 1 of 1

Average of day over several years

Posted: Sat Aug 20, 2022 3:28 pm
by mister_v
Hi, I making a temperature app
and want to get the avearge temperature a day over several years.

Anyone knows the SQL code to do this ?

Re: Average of day over several years

Posted: Sat Aug 20, 2022 4:12 pm
by chris
Nice project, may I suggest alo add the max and minimum.

The folowing code should be a good start:

Code: Select all

SELECT MONTH(datum),DAY(datum),min(temperature),max(temperature),avg(temperature) FROM temperature GROUP BY MONTH(datum),DAY(datum)