Hi,
I am trying to figure out how to find the avg in between two dates in the work_date field. For example, let's say I want the avg from 2007-01-24 to 2007-05-06, I would have to find the avg by taking the values in the daily_typing_pa ges columns and add up all the columns between the the dates provided. (E.G. (100+220+350+25 0+170)/5).
this is what i tried but it returns empty set.
[code=mysql]
select name, avg(daily_typin g_pages)
from product
where work_date between '2007-01-24' and '2007-05-06'
group by name
[/code]
This is really important any help is appreciated
I am trying to figure out how to find the avg in between two dates in the work_date field. For example, let's say I want the avg from 2007-01-24 to 2007-05-06, I would have to find the avg by taking the values in the daily_typing_pa ges columns and add up all the columns between the the dates provided. (E.G. (100+220+350+25 0+170)/5).
Code:
+------+------+------------+--------------------+ | id | name | work_date | daily_typing_pages | +------+------+------------+--------------------+ | 1 | John | 2007-01-24 | 250 | | 2 | Ram | 2007-05-27 | 220 | | 3 | Jack | 2007-05-06 | 170 | | 3 | Jack | 2007-04-06 | 100 | | 4 | Jill | 2007-04-06 | 220 | | 5 | Zara | 2007-06-06 | 300 | | 5 | Zara | 2007-02-06 | 350 | +------+------+------------+--------------------+
[code=mysql]
select name, avg(daily_typin g_pages)
from product
where work_date between '2007-01-24' and '2007-05-06'
group by name
[/code]
This is really important any help is appreciated
Comment