Hi,
I have a table with date for every day.
But I want the average by month.
Is there a simple query that can do that,
Or do I have to calculate it on the application layer?
Solved: Get average by month on a select.
Re: Get average by month on a select.
You can do it in one query:
I haven't compared the speed,
but it is probably faster then to do it in the application.
Code: Select all
SELECT id,year(date),month(date),avg(price) FROM table GROUP BY id,year(date),month(date)
but it is probably faster then to do it in the application.