I’m trying to avoid involving php after this query. I have a table that holds a list of employees and how much time they worked in seconds,date, etc… i want to:
select SUM(`seconds`) between date A and date B group by WEEK(`date`)
that will give me results for each week but now i want to get an average seconds worked per week by using AVG() on the whole result set. How could you accomplish this in one query?
This will do the trick: