Trying to get the average number of a value by day in SQL

65 Views Asked by At

I am trying to get the average number of posted jobs by day and cannot figure it out from any of the similar prior questions asked on this site. This seems pretty basic but for some reason it isn't working. Can someone please help? Thank you!

select avg(count(*) 
from select (count(*), to_char(thedate, 'MM/DD/YYYY') as date 
     from jobs where companyid = 1)
1

There are 1 best solutions below

0
On

Try this:

select avg(jobNumber), date
from select (count(*) as jobNumber, to_char(thedate, 'MM/DD/YYYY') as date
 from jobs
 where companyid = 1
 Group by to_char(thedate, 'MM/DD/YYYY')
) innerSelect
Group by date