PHP Database take average and counter


I have a database that has this

Date       -   Temp

2013-12-01 -   12    
2013-12-31 -   18

Holds 1 month. Im graphing this by JSON in my PHP page. But I want something different, to graph it weekly. Like It will take each 7 days temp average and if I find a suitable sql statement for it, it would be great.

I found this in my pdf.

SELECT Date,Temp COUNT(Date) AS weekly, AVG(Temp) AS Temperature 
    FROM temp2 GROUP BY Date ORDER BY Date;

But it will take all the 31 days which is not weekly but monthly.

Anyways, is there something you can do?


People are also looking for solutions to the problem: php - Instagram video fetching not working?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.